He doesn't always attack. He simply CAN attack. He's just an aggressive prey animal. He doesn't hunt other animals but he would attack animals that he knows to BE aggressive predators because he's skittish and hostile towards potential threats.
Sure, if that's how it worked. But in most military AI checks, a gold allowance concern does not exist because the military unit is considered absolutely 100% critical. This is where the AI freaks out and panics under strike. The original reasoning was, just because the AI isn't bringing in enough $ doesn't mean it can manage an empire with no military units guarding its city, nor can it handle letting its properties go crazy bad. These things are rapidly causing the gold problem to escalate further so when a unit becomes an answer to improving the gold problem, a unit gets built, even though the strike may make the unit short lived. After a while, the strike does resolve usually. Most likely because losing all its units means a lot less upkeep. But if it doesn't, it's because the AI has overgrown and is being eaten alive by upkeep and crime. There's really no way out for them except to lose a city or two at this point. Sooner or later an enemy will oblige them.
The AI improvement that would need to be made is to actually filter potential build/train options more rigorously IF an actual STRIKE situation has been reached. At the moment there is no programming for that.
The cities building lesser wealth are the ones that have built themselves up enough that no other priority is considered a good idea. With many things being considered unnecessary during a strike, some cities may get to this point quickly and those will really bail out the nation for a while.
Teaching the AI how to balance building wealth to support a stronger empire than it normally can when it really needs to (as a player I've been there most games) is possibly one of the most complex things you can do. There's a lot of reasons that an existing military force can become too heavy for the empire to support suddenly... prosperous cities being taken, too much growth too fast. A number of reasons. There are many things that could be done to help the AI improve its gold management, all of them quite complex.
He probably values the building of slingers because he doesn't have enough defenders. Maintaining a minimum # of defenders is a fairly high priority for build selections. Much higher than developing the land with gatherers. Whether a gather, when needed, is chosen for training over a defender is not a direct comparison. What happens is that the minimum defense needs are checked before the land development needs are checked. If a need is checked and it comes up that the need exists, then the city will attempt to fulfill it without bothering to check later priority needs at all.
Thunderbrd, as i told you Musk Ox always attacks, always!

Evry time on my game when you stay close one, like a predator animal with the black flag, i have recless animals on in my game now, so its a reckless animal bug or the musk ox is justed bugged or he needs the black flag not the green. So is really bugged. All other animals with green flags dont attack stronger units, musk ox always attacks also stronger units.
Also Hamurabi was able to get back in + gold 20 turns later and had no STRIKE, so i think the problem is when they dont have any building left to build then they build military units, other AI builds lesser wealth or research, but maybe looks like the AI will sell some of there units if they build to mutch, so these AI players like Hamurabi has to given the trait or they have to be teached to use lesser wealth not build military units endless. Find a way, if there is non.

We will see if the AI is able to survive in some more turns, maybe 2000 turns.
"Teaching the AI how to balance building wealth to support a stronger empire than it normally can when it really needs to (as a player I've been there most games) is possibly one of the most complex things you can do. There's a lot of reasons that an existing military force can become too heavy for the empire to support suddenly... prosperous cities being taken, too much growth too fast. A number of reasons. There are many things that could be done to help the AI improve its gold management, all of them quite complex."
Just make it so that you cant build military units when you have 0 gold or -gold in your treasury, also for the AI so this problem will be fixed and the it will make the AI mutch more better i think. Or teach the AI if there is no building left to build until they get a new tech then prefer lesser wealth or lesser research, only build military units if you need them. But when the AI sell the military units when they get to mutch so they will not go bankrupt and can survive at least.
"He probably values the building of slingers because he doesn't have enough defenders."
No he has 20-40 slingers, more than enouth defense, all players have only 1 city at this time. Only i have 2 because i destroyed the iroqs...