i'm not a coder, so i can't say, but it seems not all of this has to be ai code, why can't they simply have scripts in the game.constants or whatever file add starbases with xx abilities turned on and have a placement value that puts sb's next to repair bays and defense platforms?
(i edited this a bit, because i know you or me can sit down right now and make two versions of an ability. Why do that? Because what if we want the bad guys, you know the pirates or the militia or even really the other ai to have something we don't, like say domination turned on for the small groups of militia to make them badder and harder to clear out the planets, instead of just rolling over them, even in early game and feeling like there not really there for anything more than just giving me more points. Or fleetbeacon calling in extra ships for either militia or pirates, or giving the militia or pirates or ai that i'm fighting more credits or more metal or crystal? Right now that can be done by making two or more versions of abilities, or small changes to the gameplay.constants file. And copying that particular file into Entrenchment or Even Diplomacy is fine, as long as its the right version. So what i'm saying is this is doable. Some of it doable by very small things that modders can do.
The Devs of course have the whole ai thing to worry about, but a tweak to make it more flashy and now have suicidal fleets against sb's could be fixed by moving that same tweak a little back in the original direction.) Anyway, just wanted to add that.)

the individual scripts, or embedded code that says check this then do that i can certainly imagine getting complicated, but it doesn't seem to me that all of it has to be embedded in the ai. Let the setup or the random configure file do some of the heavy lifting to take it off the ai, and get the ai back to if i have 5 ships and you have 3 then fight, or if i have 5 ships and you have 10 then fight, but when i lose 5 ships, run.
like i said, im not a coder, but it seems to me, that some of this doesnt have to necessarily be complicated. Look at how much the modders have done just with tweaking values and changing abilities around.
Some of the mods are pretty amazing stuff.
Of course this is all my rather over simplified guess as to how to start fixing some of these things. But im not a dev, and if i had to write code then i'd fall on my face.
But again, just my two cents, 
-Teal