I think this confuses justice and morality. Justice as I understand it requires a shared knowledge of a common standard and enforcement mechanism.
edit: I hope nobody here is getting the impression that I’m saying “it was morally wrong to punish the Nazis.”
Justice as a term is frustratingly underdefined, see this thread. Optimally we would have better terms for what that is, but I think it’s more accurate to say it’s “bad” rather than “unjust”. It’s incompetently constructed justice. You could manifest principles of justice that it violates, such as “does it actually achieve a social objective”, but it’s hard to get agreement on those. If it is fairly applied to all, I would argue it still meets the definition of justice even though it’s extremely silly and destructive.