The simplest answer to this problem is to present challenges (social, economic, asymmetric, logistical, logical, intuitive, academic, pathfinding) that cannot be solved by skeletons.
A perhaps even simpler answer is to simply state your problem to the players, and have them come to some solution to solve it from both sides of the table (such as by reducing the necromancer's power level, either out-of-game or by some story event).
However if you want combat encounters that can challenge the necromancer without doing either of those things, you probably want to look at;
Enemies with Rogue class levels or other abilities would probably aim for the necromancer's soft wibbly flesh bits rather than his minions. After their base is destroyed by the necromancer's overwhelming power, they attack in the night to poison him while he sleeps (or some such). This is a type of attack that challenges the necromancer while allowing other characters to shine (such as by detecting or foiling the attack). It's also a very natural thing to happen, as the necromancer is the clear point of weakness in his horde. Focusing on disabling the necromancer first also makes perfect sense, as if the necromancer is able to command his horde, the rogue(s) will all die very quickly unless they can escape.
For extra points, try to have the rogues escape if their attempt fails, and have them (an organization, for preference) be a recurring villain as they attempt additional means of killing off the necromancer (have the PCs find out that they consider him the main threat and can 'easily' mop up the other PCs when the necro is dead - ideally use this to motivate the other PCs to show they aren't small fry, and foil/kill the enemy assassins) such as poisoning supplies, sneaking their way into the camp inside loot objects (such as art statues or something), long range sniping, so on.
There are spells that specifically stop kinds of things from entering areas, or that target kinds of things. Enemies might have access to such things and choose to use them against the undead. The party is like 90% undeads, and only 10% living beings, after all. Feel free to have new kinds of spells available to NPC spellcasters - as the GM you are encouraged to invent new kinds of spells, monsters, magic items, or other things to populate your world.
the Order of the Red Vanguard's Sentinel Golems are flooding in through the entryway and are no joke, they hit hard enough to crumple steel. The Necromancer is holding them off while the party hits the lab technicians (led by Gaer Sorras himself) to grab the heart of the mountain before they manage to use it as a power source for their Worldeater, a juggernaught humanoid-shaped machine they plan to conquer Daevenar with.
If the Necromancer goes for the Heart and the party mostly goes to hold back the Sentinels, Gaer Sorras pulls his Tchotchke Armour from an extradimensional space directly onto his body and becomes untouchable by any physical means while able to reach through flesh and bone and pull out chunks of your insides, while the sentinels attacks are powerful but kinda clumsy and dextrous and small player characters can often dodge them while cutting through the exposed tubing to disable the machines.
If the necromancer's minions and the party split equally both ways, you get Four Fights - the necromancer's huge skeletons struggle to hold the sentinels off while player characters cut the tubing and aim for the controllers behind them, and Gaer Sorras pulls on his tchotchke armour while his minions desperately try to connect the heart of the mountain and need someone to stop them while the skeletons hold off Sorras.
If the sides switch, it can get a bit problematic as you've already established that one is strong and one is weaker, but you can do things like have Gaer Sorras turn and grab the heart of the mountain, muttering an incantation in ancient Voldian that causes him to start to levitate and glow, clearly getting stronger although probably at some horrible cost etc, and the Sentinels burst into the room forcing their controllers to move forward to stay in range, a range at which they are suddenly vulnerable to being flank and cut down (stopping the sentinels dead). Etc.
Basically you use description and stuff to make it clear there are two objectives in many fights. That need to be attended to at the same time, not one by one. So the party needs to split, and this gives way more opportunity for player characters to have Very Necessary Jobs that can't just be palmed off on the skeletons. As the skeletons split to handle more jobs etc you just create more situations that need to be attended to and force the party to handle it.
Give The Skeletons Less Screen Time
If the skeletons will roll an encounter, you turn it from an encounter into a description. 'Your skeletons rip apart the Chaos Hounds with little problem'. If the skeletons are fighting the sentinels, and the PCs are fighting Gaer Sorras, you don't give the skeletons any turns, you just tell the necromancer how much damage they take after rolling some dice and give him a rough countdown for when they will be overwhelmed and the sentinels will flood the room. Refocusing the narrative onto the PCs every time and making sure the necromancer and his minions only get about the same amount of 'screen time' as the other PCs do individually will naturally remove focus from their overpowering strength.
You can 'solve' this problem other ways, by limiting the necromancer's power, bringing enemies that kill off all skeletons while not being useful if raised from the dead themselves (class leveled guys, clerics etc), having the necromancer not be useful in fights in various ways (space too small for Gargantuan sized skeletons to enter) etc, but that's a fairly limited solution that restricts your palate at the same time as lowering the ability for the necromancer to interact with the game.
My 'assassination' and 'wards' solutions are similar to this, but allow a significant degree of 'being played around' that can use the rest of the party's skills to allow the necromancer's skeletons back into the game - at which point they stomp the enemy. You can make solutions like this work but you have to work in both ways for the necromancer to still be part of the story in the way he wants to be, for the best solution.
The best way to solve it I put at the very top of my answer - talking to people, finding a consensus solution (even one where you just de-emphasize combat and have the skeletons performing off-screen mayhem while the players J'accuse! on the main villain with legal documentation). You can make it less of a problem in a lot of ways, but in general in dnd any time you're being creative you're going to result in a funner time for everyone than simply trying to beatstick the problem to death with bigger numbers. Numbers lose their shine after a while, but fun storytelling rarely does.