While this is being looked into and any bug fixed there seem to be atleast one way to avoid it to happen and that would be to temporarily pause the construction of the facilities on planets you suspect you can loose control of. If you are in control of the planet and nothing finishes there shouldnt be no risk of change of planetary government.

more updates to come.