It's only really morally ambiguous if what he accomplished was something that he thought could benefit more people than himself.
Honestly, Right now I'm starting to think that Xerath ISN'T supposed to be a morally ambiguous figure, and that they rewrote him with the full intent of turning him into Jafar, and all the complaints that they received over this dumbass rewrite has made them go "Oh shit! I mean... He IS morally ambiguous! You just haven't seen the whole story! Yet! Bye!", and are currently trying to cobble something together to placate the complaints.
Either that or they're hoping that we just forget about it eventually, like 95% of the time whenever they do something lore-related.