Not always, but for a while now.

It was to stop the PvP House-Hiders (and a couple of exploits involving NPCs).
It isn't only if you're flagged tho. It is Supposed to prevent you entering a house for a time after you attack anyone/anything. It doesn't always work, and I think killing your target (without flagging) clears the timer.
I know it bugs out sometimes tho. Recalling home on my smith to be attacked by a troll and unable to enter my house for example - even tho I never hit back or cast anything.