Hiya! As far as I understand it, Megastructures can be captured by other civilizations. The megastructures are considered as planet when trying to capture them and require a high enough conquest rating. They do not get destroyed unless you use the decommission button. Doing so does not give you back the gigamass though.
You can indeed place ships in the structure to defends them, like you would for a starbase or a planet. I just tested it with a Dyson Sphere and a Ring World and in both case I could station a fleet in them by clicking in the middle of the star.