To quote a post I recently found resonating with me:
"Look, we don’t necessarily hang murderers to deter other people from committing the same offence. We kill them simply because the punishment has to carry the same weight as the offence. The family of the murderer must go through the same anguish and pain that the murder victim’s family went through. The killer has to be stopped from enjoying all the things that come with being alive. When you kill another person, you deprive them of worldly enjoyments like food, sex, conversations, bathing, laughing, crying and therefore it is only befitting that you too get deprived of same and the only way to do so is through the death sentence. If we are going to shy away from punishing wrong-doers on the basis that the punishment won’t stop other people from committing the same offence then we might as well not send anyone to jail because sending people to jail has never stopped other people from committing the same offences."
https://www.sundaystandard.info/iocom-a-retributionist-i-sup...
But executions change all that. Whether or not a person supports capital punishment reveals if their morality is a flimsy thing of feelings and self-interest or a thing of principle. It is safe for someone to hate a heinous criminal and wish them ill. There's little fear of guilty feelings or reprisal. The average person will give in, baying for blood purely because they want to see the hated person suffer. A good person will refuse to hurt others no matter how badly they want to.
Capital punishment is a good litmus test. It reveals those who are murderers deep down inside.
Does this include or exclude killing in self defense? Would a good person allow themselves to be killed rather than harming the attacker? Imagine that the assailant would be rehabilitated after serving 10-15 years for your murder and live a productive life with family and kids, does that change the equation? Is absolutist pacifism the end goal or is there an arbitrary line you are willing to draw?
Executions are different. People are not afraid to admit that they support executions because they like knowing that hated people will suffer. That is not something I will consider acceptable under any circumstances. If there were any evidence that capital punishment served a purpose beyond feeling good I might change my tune. But there isn't, so I won't.
You yourself admitted executions serve no practical purpose, so your self-defense hypotheticals are irrelevant.