Whatever we think of the AI, the AI has to be seen in combination with the game obviously. It is no secret that the Civ AI can handle stacks much better than 1upt warfare. That's problem #1.
Civ 6 then added lots of convoluted mechanisms that the AI can simply not handle. To me Civ6 is unplayable except for multiplayer. I played always war games in Civ6 and the AI is downright comatose. To make matters worse, they added expansions that made it even more complicated for the AI.
One would of thought that they had learned their lesson, but Civ7 isn't helping the AI it seems. Yes, they got rid of workers, but it seems, city management isn't easier for the AI. It's also no secret that Firaxis has never prioritized AI development, as it doesn't concern sales to casuals. The most notable improvements to Civ4 came from a modder and was partially incorporated into one of the expansions. Civ3 has been blessed with a mod that finally enables to AI to effectively use siege weapons and armies. Took more than 2 decades, but it is there. Not sure, whether modders can salvage this situation yet again, looking at Civ6, I highly doubt that.