This might help. You're sort of right.
https://catholicnewslive.com/story/120271
This is precisely what I was getting at. While an executed person is in no danger of death from sickness
before the execution, once it takes place (just having had fatal shots, hanging, blades, etc. inflicted upon their person), they are certainly "in danger of death" in the most extreme manner possible --- again, not to be crude, but they're certainly "sick" at that point, you don't get much "sicker" than that! --- in fact, the body has died but the soul may linger for a time (an hour, as noted above). Though it's highly unlikely, a miracle
could take place, after all, Our Lord raised people from the dead (not to mention that He rose from the dead Himself after having been executed), and in any event, the
spiritual healing intrinsic to Extreme Unction would still take place.
It's interesting to think of what would happen if Extreme Unction did, indeed, bring the executed criminal back to life. Would they then walk free, in that the sentence would have been carried out, they were killed... and then "came back from the dead"?
(I'm reminded here of the joke about an Englishman, a Frenchman, and a man of a nationality I won't specify, being sentenced to death at the guillotine. The executioner asks the Englishman if he has any last words. He says "Rule Britannia, God save the King!". The blade falls but gets stuck halfway down. He lives and walks free, as the sentence has been carried out. Then the executioner asks the Frenchman if
he has any last words. He says "Liberte, egalite, fraternite, vive la France!". The blade falls but gets stuck halfway down. He lives and walks free. Then the third man is asked for
his last words. He says
"if you put some grease in the grooves, it'll fall all the way down and won't keep getting stuck...")