The death sentence is not intended to perform any of the above feats of majic. It only does two things; provides a certain degree of deterrence, and guarantees against recidivism.
Just because something may create a deterrent and stop recidivism doesn’t make it just. Islamic Sharia Law has all kind of deterrents and anti-recidivism devices.
There are other, effective ways to create deterrence and avoid recidivism. The failure, especially to stop recidivism of dangerous criminals, is due to a broken penal code and prison system that doesnt place restraint (protection of society against dangerous criminals) at the top of the list of why we incarcerate criminals.
It’s easier to just kill ‘em.