Death sentence does not, and has never, worked as a deterrent.
The death penalty doesn’t work on irrational actors - ie the desperate and the mentally unwell. Those who commit most crimes. The death penalty as a deterrent to rational actors (such as opportunistic politicians) is very much part of the mental calculus that goes into decision-making.
It’s also super fucked to say “sometimes you gotta kill a guy cause too many people agree with him.”
No, that’s actually pretty normal. People agreeing with genocidal dictators is a bad thing, and taking out the dictator is greatly preferable to taking out all the people who agree.