protect A transformer from a DC voltage
Why don't you just ac couple the input of the transformer to the voltage source. You can do this with a non-polarized capacitor. Depending on the transformer and it's secondary load the capacitor might be 0.1uF to hundreds of microfarads at which point this idea starts to become unfeasible. But please do state what the transformer feeds so this idea can be ruled in or ruled out.

Prevention is better than cure!