Most astrotrains require an inordinate amount of firepower to take them out. They may as well be invulnerable.
Astrotrains come whenever they want, even during waves or exos.
A unit that is allowed to be attack normally becomes the preferred target of any units that are ordered to attack said unit when they are manually targeted.
Two modes exist for targets. Manual only, and automatic. Automatic targets in order: Prefered Specific, Prefered Group, most damaging shot. There is no way to decouple this behavior for one unit without placing it in the manual only group.
If Astrotrains are placed in the Automatic targeting group, turrets will often fire on them automatically during other attacks, which could result in player wipes. Since many astrotrains that can be damaged are somewhat harmless immediately, it was chosen to put them all into the manual targeting group to avoid this sort of issue.
This is a summary of why Astrotrains will not be fired upon automatically by turrets/fixed defenses as I understand it. The alternative could be far worse in many situations.
A better alternative to getting the trains out of your territory is seek out and destroy train stations that would cause the trains to cross your territory. The trains always travel between 2 stations in the closest route. Using this knowledge, you can intelligently hunt down the stations responsible for causing train routing through your area.