But as Jon Shafer himself pointed out, it does not matter how well something is intended or how brilliant the internal mechanics are designed or programmed. What matters is how the player preceives what the AI does. And if that does not make sense, it's a bad feature nevertheless...
That's a fair point, however in criticising it what's important is to identify what it's getting wrong and where the problem lies. We've all seen cases with the Civ V AI where you'll see the 'Friendly' category applied despite the fact that most or all the modifiers shown are negative. That's not the AI's fault - Monty doesn't know the system's telling you he's friendly, all he knows is that he hates you because of all the various negatives described in the tooltip.
It's purely a classification problem - the AI is using the 'Friendly' tag for a civ that is not friendly towards you, and isn't even pretending to be friendly if you look at the modifiers. Often civs with those modifiers will actually behave generally in an unfriendly manner - they'll refuse like-for-like trades, they might have denounced you a couple of turns ago etc. If you pay more attention to the actions a civ likes/dislikes, you'll find that these are a much more consistent guide to predicting their behaviour than whether or not the system tells you they're "Friendly".
But that's something different than what we have in Civ V. I have no problem to imagine an AI that plays friendly on the outside but has a grudge nevertheless and plots in secret against you (Cathy-style).
That's not what I'm describing, and it's taking anthropomorphising the AI a little far to boot. The AI doesn't even know you think it's being friendly - that's a label you see that the AI doesn't. I'm considering a situation where you might have done nothing to give the AI the impression that you're being friendly, but imagining that a tag is attached to the AI's diplomacy view describing you as "Friendly" - this is the equivalent of what you see with an unfriendly AI that's given the wrong label by the system.
No big deal programming something like that - and this sure would add some spice to the game. I also have no problems imagining an AI that takes precautions and says: OK, the player seems friendly - but those guys are usually SOBs so let's keep some extra troops in a spot where he can't see it. Or how about a secret defensiv alliance?
I've rarely if ever seen AIs use defensive alliances - maybe once or twice in G&K, but I've never attacked someone in BNW only to have someone else enter the war on their side. But that could partly be my generally non-aggressive playstyle.
But that's not what we have in Civ V. From Civ IV we went from rational, rely-, predict- and exploitable to irrational, erratic, autistic - and still exploitable. Not sure what makes more sense in a game of strategy...
I'm not sure how you're intending "autistic" here since it's a characteristic of the condition that behaviour is often overly rational, not to mention highly stereotyped and so predictable. But that aside, I find that I can very reliably predict what an AI will do in Civ V, based both on civ identity, my actions and the various relationships in the game as a whole. In my last completed game, for instance, war declarations against me followed my settling choice territory or marrying a city-state adjacent to the offended civ's cities.
If I was attacked by an "unusual suspect" it was generally a joint declaration with a known enemy who I imagine as being the instigator, and I can see why the civ would be willing to join. Such as Darius, who I'd repeatedly stolen technology from and just married Cahokia, adjacent to Persepolis, and who already thought I was expanding too aggressively. Is it any wonder he refused to renew a DoF and joined Assyria's war against me shortly afterwards? Possibly Ashurbanipal approached Darius in part because Harun was out of the picture - he'd been involved in the first war against me, but when I allowed him to have peace instead of taking Damascus, he was ready to sign a Declaration of Friendship. Harun is not a backstabber, so he probably wouldn't have been willing to attack (quite apart from then having the game's weakest military).
As for Ashurbanipal himself, he needs to conquer to use his UA and Assyrian units were milling suspiciously around the edges of Colombo even before I married it - his behaviour as a result was entirely expected, and consistent with his pre-existing objective (he wanted Colombo, so if I was in control he'd have to go through me).
Then there was Montezuma in the same game. Monty remained steadfastly neutral towards me despite mostly positive modifiers. He was, surprisingly enough, the only one of the game's other five civs never to be involved in a war against me. But when I needed an ally he was my go-to hired thug - when Darius wanted several of my unique luxuries to take on Carthage I asked Monty instead, who responded "You got any spare horses?". He thought I was a warmonger for taking Nimrud at the conclusion of my first war, but tolerates warmongers. A war later, he now has negatives with Dido and a positive with me for fighting a common enemy, so when Dido next declares war on me I bring him in again, and again get a good deal (by that point we all three have the same ideology, but Monty clearly has more reason to like me) - that war lasts the rest of the game even after I secure peace with Carthage.
In that game I never had any trouble either predicting or understanding the other civs' behaviour, to the extent that I could manipulate Montezuma into fighting my wars for me in a way I couldn't with civs I'd treated less well (such as Persia). I got an unexpected war declaration from Dido the first time she attacked, but that was the only time I was caught unaware and her target was Gratz - a city she'd complained about me settling much earlier in the game and that it made sense for her to want. She tried halfheartedly to press on for Salzburg, but offered peace immediately after that failed having achieved her primary objective (naturally I didn't accept since I wanted Gratz back - and she was much more accommodating after that). Civs were even - without exception - willing to take a no-strings-attached peace deal when their attacks failed, when I was encroaching on their territory, and/or they were under pressure from another civ.