Don't AIs sometimes stop building units and start building other stuff after 10t?
I haven't heard of such a hard-coded rule. Do you know of a code-diving effort that was done to support this number 10 or is it more of a gut feeling?
It is possible that if an AI who builds a greater percentage of defensive Military Units ends up with several Military Units inside of a City (say, 6 of them), then that AI may be programmed to switch to a different build item if it rolls a "build a defensive Military Unit" dice roll, but that's purely conjecture.
I've heard that the MISSION for an AI unit gets assigned at the time of completing the build item, so the game may not have a concept of which types of units would be "defensive" ones or not, at least in terms of build-item selection. Still, there may be something to this line of thinking, as some AIs do seem to build more infrastructure once they have about 6 Military Units (not counting one of their roaming stacks) inside of a City, but that's purely my gut feeling and is not supported by code-diving.
From my understanding, an AI has a higher chance of randomly choosing to build a unit during wartime (I seem to recall the number "5" being mentioned by a code-diver, and while an increase of 5% doesn't sound like a lot, iBuildUnitProb is already only between 15 and 40 for AI Leaders, so going from 15 to 20 is a relatively big jump in percentage--how do you write that kind of a percentage, by the way? Is it 25% higher (5/20) or 33% higher (5/15)?).
I have seen AIs stop building World Wonders when a war was started. At the same time, if an AI is 3 turns away from completing a build item, including a World Wonder, that AI won't switch away from that build item, although that AI might whip that build item in order to complete it in less than 3 turns.
I have also seen AIs start building World Wonders a turn or two into a war, so it's not like an AI will have a 100% chance of building units.
Also, if one AI's Military Unit gets close to a war enemy's City (and some AIs love making roaming Pillaging parties), that enemy AI's City is likely to switch build items to a Military Unit or a City Walls build item if their current build item will take more than 3 turns to complete. So, there is the chance of one AI causing another AI to build more troops or defences.
Sometimes, a Pillaging party can make it pretty deep into another AI's territory, which could theoretically mean Walls, Castles, and City defenders going up in multiple Cities due to another AI's Pillaging party threatening nearby Cities and thereby affecting the build items.
EDIT: With Espionage giving me full view of Hatty's Cities in a different Deity game that I'm playing, she was spamming Cavalry and Riflemen from all of her Cities when at war with another AI, even though she wasn't sending the troops out anywhere and was creating large stacks of Military Units (8, 9, or more) in most of her Cities. That was until about turn 18 into the war, after which point the war ended. As soon as the war ended, she started spamming Buildings non-stop, with the only Military Units still being produced being the ones that were 3 or less turns to completion. So, maybe in BtS, particularly on Deity, all bets are off and AIs really will spam a ton of Military Units when at war. Be warned.