If I remember correctly, you used to get pvp turned on in a pvp realm if you attacked the npc's or an opposing faction member when they had pvp. But now if the guards attack me, I get pvp on whether on not im trying to be hostile.
At low levels where they have a large aggro radius in proportion to you this is frightening...am I crazy or did it change at some point?
For as long as I can remember, there's always been a chance that the guards will flag you when they hit you. I imagine that it's a bug, since it happens rarely, but it's not a new one.
I personally would agree people getting flagged on attack, because if you are anywhere near a Guard to the point that the guard will attack you, then whatever you are doing is probably PvP or a attempt to harass the other Faction in some way and you should be flagged.
Also, small town guards should be boosted to level 85. The whole reason that they are still level 40 is for RP Reasons and I would rather have able bodied guards defending my quest-givers instead of having a 85 Horde RPing that he is the God of War or something.