Sometimes, the player will attack an AI he's Friendly with, suddenly, without any other reasons than to win the game. Why shouldn't the AI do the same?
Nope. It isn't so simple.
I have actually gone through this a lot of times. Let me just summarise it here. The game has a diplomatic system that ultimately means nothing, am I right? I mean, players certainly don't care about having the same religion as the AI, so why should the AI care? Now you see where this is going?
Furthermore, this locks you into a strategy of building lots of units to ensure your security. If you can't trust your friend on one side and want to fight your adversary on the other, you'd be forced to build sufficient garrison to guard against backstabbing
and build units to attack your enemy. This results in a large number of units, which many players find tedious to manage. And an idle army is generally agreed to be a drain on resources, especially as it waits for an attack that may never come. So, ultimately, you might probably want to use it as much as possible, turning it into a game of war, war, war.
I prefer more flexibility in gameplay, and therefore the diplomatic rules must be obeyed by the AI as much as possible.