It seems to me like this could be done through a combination of themes and permissions. Granted, it's not a simple setting, but I think it'll be less involved than hacking the code. I also don't have time to figure this out entirely right now, so I'll just outline what I'm thinking about and let someone else tear holes in it.
First, you'll want to take away all of the Anonymous group's permissions, including setting all of the the section perms for them to Hide or Deny. That way they won't be able to view anything, which I suppose accomplishes most of what you want.
Then, to make it easier to use, you could use themes to show Anonymous users a different main page than regular users. You could make index_template be just a login box for anonymous users, and make all the other _templates blank so that any other page a user hits has nothing. Then they would have to login to see any part of the site.