I believe it was considered common courtesy once, nothing more nothing less.
This is an important point. Common courtesy is not about "rules"; it's about being courteous to those around you, per the expectations of the culture in which you happen to find yourself. And if you're in a position where offense might be given, common courtesy dictates doing the least offensive thing possible.

With that in mind, today's society is such that people aren't offended at hats being worn indoors (unless one lives in ultra-high society, of course). For us regular folk who are just trying to be polite while we do the things necessary to live our lives, given today's standards, and in a scenario such as I described in my previous post, I would think that the least offensive thing to do would be to keep a hat on one's head rather than take it off. There's going to be more offense taken at unkempt hat-hair than at the hat itself.

So while that may make me less than a proper gentleman, I take umbrage at the declaration that it makes me a rube or an oaf.

On the subject of removing one's(male) headwear and I don't know if it is common place, but removing one's headwear whilst in a graveyard is very much a custom here.
That is the tradition here too, at least in the circles with which I'm associated. A cemetery is like a church in terms of removing one's hat and acting reverent. Most people around here take off their hats when a funeral procession passes by on the street, too.