I believe the easy answers to both are "no, you can't".
Possible workarounds: Each design has a setting for how to invade ('invade when clear' and similar). If you are able to mod the game to always use that setting, the sneaky invasions will not happen. I am not sure if that is possible, though.
Changing target priority is not possible. Manually targeting defensive bases is not possible as far as I know. When I defend my planets, I micro manage. I have long range scanners that gives warning or allow me to manually spot incoming invasions. I make sure to have a fleet on top of the colony when they arrive, and manually tell my fleet members (individually or by dragging around a few) to target any close troop transport. Mix this with a decent amount of ground defense in case a few get through, and the colony survives.
There is an advanced tech (I forget the name) which puts a field where ships can not exit hyperdrive. With this "on" the defenders have more time to kill the transports before they reach the colony. I have never used it though, as my games never get that advanced :)
When it comes to defending the key colonies, it helps that there is sense to "what the AI attacks". It goes for the close targets. So there are only so many important colonies that are likely attack targets, at least if you try to keep your borders somewhat clean.