I'd hoped LUA would be able to do something, but oh well. I suppose there wouldn't bea huge problem with those factions getting a free barracks on their planets instead of using a black hole, it could be balanced out in other ways. More important than era progression is probably being able to split it between different subfactions (Teradoc, Zsinj, Pentastar, etc for Warlords, for example)
The bulding doesn't even have to be free.
If I remember correctly it is possible to take money from the player using a script.
However, the player will get lucky if he has less than required, cause the command will just take what he has in that case.