Lol stupid AI.
Btw do you know what causes the AI to actually move units to attack one he's at war with? Typically I make them war each other and I can watch a dozen units just sitting around in their borders. Like right now I'm playing a game, Rome is at war with Assyria who's right next to him and I can see 6 trebuchets just sitting there near my border. He used them to attack me earlier and now he basically forgot they exist or maybe he can now only use them to attack me or something and since we're at peace he's like "CANNOT MOVE UNIT. CANNOT MOVE UNIT" lol
The whole 1UPT code is very difficult to read and interpret (movement, combat). I can only tell you how it works at a high level. Basically the AI thinks in terms of armies and reserve units. To attack someone the AI first call for the creation of an army. This army creation part then itterates every turn to fill up position in an army. It asks for X amount of range, Y amount of melee etc. Some units are elligible some or not. Also the whole process of army creation is under conditions. Once that is done it will then proceed to move the whole ordeal toward a target. In the route calculation there is an abort condition where if the AI is unable to move its whole army to the target it will cancel the whole thing.
All this is very far from solid and will make the AI do weird stuff.
Hopefully Acken can share the source code, but the basic problem seems to be that the AIs have no memory, no planning, and decide their actions at the start of the turn based only on what the AI sees at the very start of the turn.
As I have written above it's not entirely true. The AI do "remember" some elementary stuff from one turn to the next when it comes to war or it's victory objective or who is a friend, who it plans to go to war with etc.
The main problem is however from 2 things when it comes to combat :
1. The code simply isn't very good to handle 1UPT (1UPT with terrain restriction, OP range units etc).
2. The maps are often too difficult to allow such a code to handle it.
(3). Range units handled by a player
It's the combination of AI coding and some non AI friendly design choices that is at the origin of a lot of AI problem civ5 has. If one of the two was top notch you'd have a lot less issue but here two negatives certainly don't make a positive.
In other word it's as if something like map layout for 1UPT was not thought in conjunction of how well the AI would handle it. The AI simply plays better on a mapscript like mine or NQmap because movements are easier.
Tbh, I have always felt that Civ5 (and Civ6) should have opened up maps for 1UPT.
But you are of course right that in general the AI evaluates a lot of things in the moment rather than the overall strategy.