Actually, guard AI is the pinnacle of success in achieving realistic intelligent behavior.
For example: How many times have you been paid to escort someone, only to be confronted with a hostile creature during the trip? Invariably, you try to position yourself between the hostile and the person you're paid to protect and quite often, the person who is supposed to let you do your job tries to jump in and attack, sometimes even hitting you with a damaging attack or spell in the process. When that happens, tell me that you wouldn't raise the price of your services if you had the option, and that you wouldn't punch them in the nose for not staying out of the way and letting you do your job if it wasn't a crime and wouldn't screw up your quest.
Be honest; You can't.
Consider that the guards are paid to... well, guard. That's what they do. And as a citizen, you're one of the people they're paid to guard. They place themselves between the danger and the person they're being paid to protect (you) and try to kill what's attacking the person they're supposed to be defending (you) when suddenly, a citizen (you) rushes in to attack and ends up hitting them with a damaging spell or attack. That's when they charge a fine to the person that didn't stay out of the way and let them do their job (you).
So, you're walking home from the movies one day and a mugger jumps out and attacks. Two police officers nearby see the attack and come over to arrest the mugger. While they're trying to apprehend the mugger, you pull out a pistol and accidentally shoot one of the policemen in the leg. Do they:
A) Tell you, "Don't worry about it. We get shot in the line of duty all the time."
B) Let you off with a warning and only take action when you shoot the policeman a second time.
C) Arrest the mugger for his crime and fine you for interfering in police business.
D) Beat you like Rodney King for shooting one of them in the leg when they were trying to do their jobs.
Considering that you have real intelligence, and the guards have artificial intelligence, if the guards do exactly what you would do (if you could get away with it) when your situations are reversed, and do basically what a guard in the real world would also do under similar circumstances, doesn't that mean their artificial intelligence is pretty darn close to the real thing? That's not to say I don't completely understand your frustration, but the guard AI isn't really all that horrible. It may be annoying, but it isn't particularly poor. Quite frankly, letting you off with a friendly warning after you stick your sword through some unlucky guard's belly because you don't let them do their job seems to be the less realistic AI option, even if it IS more player-friendly.