When a long train rides over a track switch, its tail may get teleported to
the other track. When there is an activated detector rail before the
switch, it remains activated after the tail teleports. After that, the
detector rail remains activated even if it is destroyed and placed again.
It goes deactivated after a train rides on it and then rides off again.
This "bug" is caused by some sort of "design flaw" in the path system.
Originally, trains passing wrongly over switches was regularily
impossible and worked only sometimes because of a bug, then it became
legitimate, but the core problem hasn't changed: The "reference"
position is at the front of the train, and the "tail" is oriented along
the track backwards.
The only non-hacky solution to this would be to set the switch position
in the moment the train drives on it towards the direction the train
came from. However, this breaks "spring switch" setups where railways
depend upon this behavior.
One of the short-term goals is a way to specify a "default position" for
turnouts that those turnouts return to once a train clears the track
section after a route or when the turnout is otherwise cleared. This
could be used to continue using spring switch setups. But I am open to
ideas in this.
Not the solution I had imagined, but this bug is quite severe in
conjunction with interlocking.