Undead also remind people about their lack of control of their circumstances. Furthermore, the type of undead being used matters. As another poster said, zombies, ghouls and ghosts are very demoralizing to the living. If the necromancers can make masses of undead with their own agency, they would be considered a threat by other countries and probably wiped out. So I'm guessing they make dumb undead en masse. But lower undead are a lot like an army of constructs. Sure they don't have morale to worry about, but they also will never be opportunistic, and rely wholly on the skills (tactics) and abilities (how does the commander issue orders to the different undead?) of the being commanding them. If the command section dies, the undead army becomes very easy to defeat.

Finally, certain magic users could destroy such an army very quickly.

So why not just make them constructs instead of undead? Same basic outcome, less population morale damage. Now they're just unhappy that so much of the country's resources are going into making the soldiers.