I think you're reading things into my comment that aren't there (given the other comments you left here).
First off, I'm strictly speaking about the legality of the Holocaust in the context of the written law at the time, because you wrongly claimed that "the Holocaust was legal". The Nazi government was disorganized and didn't exactly do everything according to the book. It's how they took control and how they ruled. Hitler ruled by decree, but a lot of that were oral orders without formal legal backing. Trump makes vague attempts to keep his shenanigans remotely legal through executive orders; Hitler didn't even bother with that. Hitler's prerogative rule was not codified and so normative law should have applied.
As such, there's no legal justification permitting the Holocaust. This isn't because Nazi Germany was actually "good" or some other nonsense. Their legal system had broken down beyond repair, leaving those in power to act with impunity. The Nazis didn't need the law on their side, as it had been rendered powerless.
We know there were Germans who attempted to investigate crimes at the camps. I believe I read about Josef Hartinger before, a lawyer (not an officer, misremembered that). He investigated murders at Dachau, but his reports were suppressed. After the war it helped convict some Nazis though.
There is an important distinction between immorality derived from the legal system and immorality derived from the lack of a legal system (thus usually derived from power). The Nazis derived theirs from power and the lack of strong legal protections. The Weimar state failed spectacularly in this regard.
None of this apologizes what the Nazis did of course. As you said and this post said, morality is not derived from legality. The Nazis effectively bypassing the normative legal system does not in any way justify their acts.
The legal system may fail to protect against immoral acts. But examining the cause is important, as the legal system is supposed to (in a fundamental sense) protect its citizens. When it fails to do so it is important to examine the why, so we may learn from it.