Ever since I modded the gaian terraformer, I've had bug reports of gaians spawning with literally hundreds of high-level weapons on board. I have been puzzling over this for about a year, and I've finally cracked it as much as I can.
The weapons that get spammed are always the secondary guns, which I change from the stock thermo cannon to a non-ammo weapon. Changing the weapon changes what the game spams over to the new one. Oddly the weapon involved seems as though it may impact how many get spawned as well.
This only happens on 'naturally' spawned terraformers: ships spawned with the debug console or with testing god-mods don't show this behaviour. They only ever have up to four guns in their loot. But the encounters have between 26 (gaian nanite gun-equipped fresh spawns) and well over 100 (older ships with the P51) weapons stuffed into the cargo hold. This doesn't happen in vanilla though: repeated tests show only normal behaviour with vanilla terraformers. Most recently I was finally able to replicate this with Elemental Shift running by hand-spawning the encounter stations themselves.
The only difference between the ship spawned by itself, and a ship spawned in the encounter? The gaian encounter has a (probably very old) custom controller.
QED: there's something funky in that controller, possibly something designed around ammunition levels that wasn't built to be future-proof, that is causing abnormal behaviour and the duplication of the terraformer's secondary weapons as cargo-hold items when a mod alters the ship to use different (possibly only non-ammo) secondary weapons.