That's only partially true.
For starters, nearly everything German soldiers did was legal under German law.
Side tangent: GDR soldiers who killed civilians trying to flee the country could easily be prosecuted after reunification because this was explicitly illegal under GDR law.
It's harder to prosecute "legal" crimes. It requires establishing there are "natural laws" which stand above any law humans put in place. For instance, slaughtering civilians is one such violation of "natural law". It's more complex but that's the rough summary.
Besides, most German soldiers simply became prisoners of war and faced little to no legal consequences. The Nuremberg trials were mostly for those who gave the illegal order - no one has time for millions of legal cases.
I have little to no clue about US law but as far as I can tell, executive orders are legal until deemed illegal by a court. The order would therefore have to violate "natural law" - not the constitution - or be so obviously illegal beyond any reasonable doubt to allow for prosecution of those who follow it. Both of those are a very high bar to clear.