That is very much the heart of it.
Consider at one extreme, public decapitation. However, only 'barbaric' cultures do this. So, the quest in the USA in particular was for a more 'humane' method, one that, incidentally, does not traumatise the executioner or the witnesses too much. (And that's a thing to consider. You probably don't want the sort of person who really, really enjoys their job to be an executioner in the first place [the normal solution to this is to appoint a condemned prisoner, but that has other problems]); and you probably don't want to send your humane executioner insane simply from doing their job either).
And so, the quest for 'humane' methods that don't traumatise anyone, which historically got side-tracked by the shiny of technology (poison gas, electricity).
Lethal injection goes to extreme lengths to pretend that all is sweetness and unicorns: victim is put gently to sleep, then paralyzed (so on-lookers don't freak out---of course if prisoner is not unconscious, this is the stuff of nightmares), then heart is stopped (apparently agonising if not unconscious). So. Many. Ways. To. Go. Wrong.
And it's all down to the pretence that the state can kill someone 'humanely'. Without upsetting anyone, not even the condemned.