The Factorio code is very well engineered, but the AAI code is quite poor and doesn't seem to allow for any real customisability - it's either a vehicle with a gun, a vehicle without a gun, or a hauler - nothing in between.
I really wish it did though :/
Anyway, I'm off to bed - 2AM. Good luck in your endeavours.
P.S: i recommend using vehicle equipment as a substitute for the mounted weapons