No, and neither does the law.
Like all crimes except strict liability offences like possession of child porn you must have the prerequisite mental state to have committed an offence.
If you attack someone with a punch and they die, it's murder (albeit a lower culpablity) because you intended to harm and it resulted in death
If you punch someone and they shoot you dead, that's murder, unless they reasonably believed without the use of deadly force they would be seriously injury.
It would require heightened fear of injury.
For example, if I had a weak skull from a condition I would be entitled to shoot you for trying to throw a punch because I am aware of the risk of serious injury, even if you are not aware. It's about the mental state of the accused, not the totality of what is understood after the fact.
Heightened fear could be from could be things like death threats or persistent attacks or a group attack. Use common sense, it's about reasonableness.
Again, the death penalty is a punishment used to enact retribution on a captive person who in theory is no longer a threat to society, and as a supposed deterrent to others who would commit similar crimes. It's not comparable to self defense, which is about the right to be secure in your person. If you were thinking of retribution while shooting someone, you have committed murder