“Didnât the soviets do something similar during WW2?”
The punishment in the USA for desertion during a declared war is also death.
Pretty standard in any military.
After a trial and conviction. The Russians shot deserters upon capture. You fight, you maybe die. You run, you certainly die.