Since Michaelangelo had the ability to paint the Sistine Chapel, our universe must be inconsistent because other people don't have that ability now?
Since Michael Phelps had the ability to win 23 gold medals in the Olympics, our universe must be inconsistent because essentially all other people don't have that ability now?
Since Marie Curie, Linus Pauling, John Bardeen, and Fredrick Sanger have won multiple Nobel Prizes, our universe must be inconsistent because essentially all other people don't have that ability now?
This idea that it is impossible for NPCs to have access to things PCs don't is frankly ridiculous. That is only true if we presume that the NPC got to that ability through basic, ordinary actions and training in a short, accessible period of time without depending on rare resources, insular group access, or individual fluke circumstances. Any one of these assumptions would be flawed in D&D-alike fantasy worlds. To depend on all of them collectively is a near guaranteed failure.
This elf spent years consuming iocane powder er...rare arcanite crystals, which are addictive and harmful, but allow more powerful incantations. This elf underwent incredibly rigorous training that requires 24-hour meditations for multiple days at a time, which humans naturally struggle with. This elf spent three human lifetimes perfecting a spell. This elf was trained by the insular and xenophobic League of Supreme Elf Recondites (a real LoSER. It sounds better in elvish.) This elf was experimented on by her previous master, the only one of 25 apprentices to survive the experiments. This elf personally developed a new spell after decades of experiments, which no one else has figured out yet. Etc., etc., etc.
Things accessible to PCs have limits, because of what PCs are and how their lives have been up to the point play begins. NPCs have fewer limits because they aren't adventurers, they can be nearly anything.