The gist: Immediately after the German surrender the Canadian army found itself coping with a large number of prisoners, so they left the German power structure in place. When the Canadians added a couple of German deserters to the mix, they were court-martialed, and the Canadians gave the Germans back some of their weapons so they could be shot.
My first thought, a deserter is a deserter is a deserter.
But it is likely that the possibility of having to use German troops to fight the Russians was the reason behind it. The Allies would want discipline to remain strong in the German army.
There was a plotline like this in the BBC TV series “Secret Army”, about a Belgian/French escape line for downed Allied aircrew, in which the Gestapo and Luftwaffe officers trying to track down the line are often at odds. At the very end, in the chaos of the defeat, the Gestapo officer has taken on the identity of a dead Wehrmacht officer, but ends up in the same camp as his Luftwaffe colleague/rival, so to save himself from being identified, seizes on various comments the Luftwaffe man made to trump up a case of desertion against him, and persuades the Senior German Officer in the camp and the Canadians in charge of it, that the Geneva conventions allowed the German authorities to continue to apply German military law, up to and including the death penalty for desertion.
I don’t think there were higher strategic considerations about the possibility of fighting the Russians, simply a punctilious and unimaginative concern for legality. There was a lot of concern about maintaining some sense of legal order and structure in the chaotic conditions of the time.