I believe there should be some sort of fail safe in place to avoid losing coins when you make a mistake sending to a wrong script, maybe miners/ nodes should never accept to relay such transactions?
Only way of creating such a fail safe is to make the output a 2 of 2 multisig in which the sender can redeem before or after a specific lock time and the second signer can redeem otherwise. The problem is that this assumes you have properly formatted your script and are sending to the expected one. In the case that you send to the WRONG script, it's impossible to recover unless that wrong script has this time-lock recovery spending condition. Miners accept ANY valid transaction or else bitcoin would be censorship enforcing.