I doubt anyone in the military believes that, if they disobeyed a flagrantly illegal order, that choice would be anything other than career-ending. So by giving such orders, you drum out people unwilling to obey, and make the remainder dependent on your personal authority for their continued freedom (since the pardon power is the only thing that assures they will be exempt from subsequent prosecution for having committed war crimes).
The political purpose of such an order, meanwhile, is essentially trolling: anyone who raises an objective will be mocked as weak and a loser simply for saying that there are such things as laws and ethical guidelines for behavior. I’ve written before about the gutter Nietzscheanism underlying this phenomenon, and specifically espoused by Hegseth: the belief that reestablishing manliness requires breaking both the law and ethical rules because in our purportedly feminized era one can presume that anyone who cares about such things only does so because he is pussy-whipped. That’s basically the message of Hegseth’s children’s book stunt in a nutshell. If you’re not one of the people who believes this, it should be obvious why it is horrible—and why it’s incredibly ominous if it proves politically effective. Even if you are a person who believes this, though, it should be obvious that, at least in the short term, you’re tossing ethics overboard—which is to say: doing things that you yourself think are wrong—in the service of a larger effort to reshape society.