This actually isn't that hard a status for the AI to hit. I've seen it before. If gold gets toooo challenging and the AI hits a wall like this where it cannot make enough gold to survive, it can tend to spiral out of control, stuck trying to build wealth and it not being enough. How to solve it? I'm not really sure. It's a good thing for the AI to consider some wealth building to patch short term deficits but there's a difference between all on wealth and still losing gold and a short term patch. The human player has an easier time understanding that. It's possible the AI needs to learn when to sack certain units better perhaps. A bit of a study in figuring out how they get into this spot may be necessary. When I saw it happen it was when I was playing rev and the AI took over my culture which I was running on complex wealth production propped up economy to support as many cities as I had.
Perhaps the reason was that for this scenario every civilization (including AI) starts with 0 gold?