Each planet would have to have a new ability on it...that ability would have an infinite looping periodic action that applies a buff to all structures in the gravity well...this buff would change the player index to the owner of the planet (basically, what Domination on the Rapture does)...if the owner changed hands, as soon as the new player colonizes the planet they should get the structures...
I think there is an easier way to do that. You can create a dummy ship that immediately applies a buff to the planet and destroys itself. You can set it so that buff ends when the planet changes owner. You can then apply another buff that changes the ownership of all structures in the gravity well once that buff ends, while simultaneously resetting the original buff so that when the next player comes along it still works, creating a loop of alternating effects that reapply themselves.
The only thing I'm not sure of is technically the planet becomes unowned before it gets colonized, which may cause this minidump if structures can't be owned by "NoOwner". However, this can be avoided by having a buff change so that only on every other ownership change changes the structure owners. My exact steps may be off if I'm forgetting something, but the process should be adaptable to take anything into account. In a sort of Sins Pseudo code.
Setup
1. Starting Buff applied by dummy ship. (Planet Status: Unowned)
Buff terminates on Owner change, on buff end apply to orbit body
2. Starting Buff again (as there won't be any structures to capture when its first colonized) (Planet Status: Owned)
Loop
Buff terminates on Owner change, on buff end apply to orbit body
3. Loop buff A, which will two buffs on termination. (Planet Status: Unowned)
Buff terminates on Owner change
4. A player has colonized the planet, so apply the capture buff to all structures, and Apply loop buff B to planet (Status: Owned)
Buff terminates on owner change, on buff end apply Loop buff A (go to step three, creating the loop).