It took me a while to summon the energy to look into this.
I loaded a pre-collision backup and tested the locking track logic with a minecart placed in various locations. The signal logic worked as expected in each case. In hindsight, I really should have done this before starting the trains.
I have a backup that clearly happens within moments after the crash. The debris is still at the intersection and hasn’t despawned yet. It’s clear the electric lithium ore train was in the intersection, and somehow smashed into the steam tungsten ore train that was waiting to enter the intersection.
It’s possible it was just a timing error caused by chunk loading on game start. The crash definitely occurred within seconds of when I started that session, because it’s a start-of-session backup. If so, it’s just spectacularly bad luck that they were there exactly then.
It’s also possible the tungsten locomotive was too close to the crossing track. The locking track was immediately adjacent to the X intersection track, and I suppose the hit boxes of the two locomotives might have collided even though they weren’t in the same block. I’ve noticed the collision testing of carts in general is erratic.
I moved that locking track 1 block back, so there’s a full block separating it from the intersection. The other 2 locking tracks aren’t anywhere near crossing track.
I also added an additional test that looks at the tungsten-return track. If there’s a train within 12 blocks, an outbound train can’t enter the intersection. A race condition should no longer be possible, by the time the inbound tungsten train reaches the locking track, either the outbound train has left the intersection, or the outbound train is locked down because it detected the inbound tungsten train early.