Would applying such an ability to all galactic bodies such as planets, suns, etc. work? I could set the target filter to only frigates and corvettes and the owner to neutral, enemy, friendly, and self (I think?).
Planets can only have passive abilities, but yes. Efficient is to use the shipyards though, regardless, they can buff each ship as it comes.
So whichever ship is assigned the module construction and deconstruction abilities has access to the build menu? Does the ship have to have these properties?
You can only get that menu with your colonized planet. You can't just spawn a constructor in an unowned well and build anyway. You also can't make normal ships constructors. If you'll notice, there is no mechanism for turning off phase jumping in the files. It's handled internally.
How would you do this? I played around with it for a little while and only got to spawning the siege and combat turrets, which are defined as frigates and are spawned in with the "create frigate" ability, which is very interesting. Can you spawn in buildings directly without turning the buildings into frigates? If not, then how could you spawn a defense hangar or a refinery as a frigate for example?
There is a CreatePlanetModule instant action, which behaves like the starbase ability. It consumes the frigate and thus can't be used directly by the starbase. So you'd spawn your "constructor" and position it where you wanted your building, then click a deploy ability to turn it into the structure. Note that you wont get any use if you build civilian structures in unowned wells.
I cannot find anywhere where it makes it invulnerable, capturable, and not able to be scrapped. It has to be somewhere in the haystack.
Much is hardcoded, that would be one of them. There are buff settings to make other things behave that way, however, the wiki has them.