The punishment in Jewish law was public mockery. Not death. The fact that they went in graphic detail how he refused his duties shows it wasn't just the refusal that caused his death.
Deuteronomy 25:8-10 8 And they shall cause him to be sent for forthwith, and shall ask him. If he answer: I will not take her to wife: 9 The woman shall come to him before the ancients, and shall take off his shoe from his foot, and spit in his face, and say: So shall it be done to the man that will not build up his brother's house: 10 And his name shall be called in Israel, the house of the unshod.
This occurs in Genesis, Fascinating! But a total non-sequitur.
shalom b'SHEM Yah'shua HaMashiach
which in my Tanach occurs
before Deuteronomy
in both time and space.