The explanation I always have used whenever I have felt the desire to explain why DnD Undead always are evil (from an in-universe perspective) is this:

In DnD, Evil is an objective measurable fact, like gravity or heat, a force and a type of energy in addition to a point of morality. So the reason why Undead are evil, is that they are created and animated using, in part, Evil.
So they are Evil in the same way that a flame is hot, and they will remain so no matter how tight a leash you keep on them and how many good deeds you force them to do - just like the flame will keep being hot no matter what you do with or to it (as long as it isn't destroyed by the process).

This is also why casting the Animate Undead spell is an evil act, but casting Inflict Major Wounds, or Dominate Person isn't- because you are channeling the literal force of Evil to do the first but not the other two. (Which even can explain why you can become evil by doing so repeatable, the act change you to be more like itself.)

This explanation work equally well for all the other spells with questionable alignment types.