On the OpenDCC website, a schematic can be found for a reverser. This reverser automatically changes the polarity when the current is bigger than 2A (normally a short). The polarity can also be changed via an external switch or decoder, so a short can be avoided…
I changed the original PCB layout a little bit and created the Gerber files for PCB production.

The schematic works as desired, the only thing I regretted that I did not add a 12V stabilizer for the relay. So the power for this schematic needs to be 12V DC or ±8VAC.  I used a 5VDC/DC converter (B0505S) to obtain the isolated 5V for the second current detector.  The B0505S does not match with the PCB, so I glued it to the PCB and used wires for the proper connection.

The files can be found here.