It didn't use to be like that and is therefore technically a bug.The guards' job is to protect important people, e.g. the governor. They don't care about plebs. That's why they don't intervene when thugs attack you, either - you're not important to them. However, if you attack the guards, that's another matter - you're now attacking a representative of the government, possibly with intent to do something to the people they're guarding, and that's reason to fight you.
It also makes a mod-added feature quite useless and makes the game less challenging.
When the system is actually working properly, we can figure out how to make it better. But as it is, I'm pretty sure this is actually bugged.