I think this myth endures because it plays so neatly into the 'poor ordinary folks thrown into the meatgrinder by the officers' belief.
Whereas 'the higher ups got off when the ordinary soldier got shot for the same crime' is something that rather more accurately reflects the thrust behind that sentiment but isn't as 'glamorous' (for want of a term) a statistic.
So as a little Dominion coda to this, the Australians were the only army of any size not to execute any of their own soldiers during the Great War.
Some say this was because by the time serious numbers of Diggers were being court-martialed in 1916 the sense was developing that these were volunteers who were fighting for a cause that wasn't their own, and therefore didn't deserve the ultimate sanction.
I'm not entirely convinced by that- I haven't done the reading, but on the face of it it smacks of reading the old Anzac Nationalism narrative back into the events.
The other, perhaps even less plausible explanation, though one that's more intriguing is that it was a legacy of the Breaker Morant case. The most public-court martial and execution of an Australian in the last war had stirred up anti-imperial sentiment and left the new Australian army determined not to kick that hornet's nest again. (Or, depending on your chauvinism, determined to show that it was more just than the Poms. Like I said, chauvinist.)
I find that one interesting because it suggests that the botched trial of a war criminal ended up saving the lives of over a hundred men.
The Cambridge History of WWI records 346 executions for the whole of the British Empire, meaning a 0.00659% rate of men executed among the soldiers. The American and German armies had even lower rates and in the case of American armies strictly for murder and rape (I dread to look at the racial balance of those executions). Alexander Watson attributes it to a judiciary system closer to the civilian one for the Germans, which immediately started being decried as part of the reason they lost by the usual suspects. The French went through too massive waves of executions: 1914, "pour l'exemple", and 1917 against some of the leaders of the mutinies. In all, the French executed around 600, or 0.00838 of their soldiers. The KuK forces went a bit higher with 754 and the Italians had the highest rate (figures for Russia are not included), with 729 executions for 0.01302% with the infamous decimation orders instated by Luigi Cadorna.
That said, plenty of armies found ways to make people not condemned to death's lives uneasy at best, with some creating disciplinary battalions to serve in.