So here's one way to wire up the contraption using about 10 bucks in eBay relay modules and minimal soldering required.
6 relays are used to perform the logic, sequencing, and power switching. 2 of the 6 relays have time-delay capability.
As proof of concept, here's a short video showing the automatic switching operation to the shared mainline. I don't have bump-n-go trolleys so you'll have to use your imagination. I also don't have the exact relay modules recommended so used 6 relays of an 8-relay module I had. I also don't have the time-delay relay modules as recommended so there's a bit of circuitry sitting on top of the 8-relay module to add time-delay to 2 of the 8 relays.
I don't know how much "theory of operation" is appropriate but the "trick" if there is one is relays #1 and #2 are wired up to be a latching relay. One trigger "sets" the relay, a second trigger "resets" the relay. Yes, one can indeed buy a 12V DC latching relay on eBay with screw-terminals (no soldering required) but it's over $10. Likewise, one could cobble together latching and timing circuits using digital IC chips which could actually save a couple bucks in out-of-pocket cost, but then this would require wiring up and soldering tiny electronic components.
The other technical tidbit is the positive +12V DC power is tied to the AC outer-rail common. In other words, when the axle reaches a trigger zone, it provides a +12V DC trigger to the relay circuitry. This active-high or positive logic makes it easier to work through how the circuit works.
If you locate the trigger zones close enough to the siding bumpers, one could replace the $1.78 60-sec delay relays with 99 cent 10-sec delay relays.
If a trolley can power up, start going toward the bumper, bump-n-reverse, and clear the trigger zone within 10 seconds, then this less expensive delay-relay module could be used. This goes to the previous comments about where in the siding to locate the insulated-rail trigger zone.