Within the D&D sphere, there are examples of both methods for generating NPCs.
However, there are so many games that don’t generate NPCs in the same way as PCs and which work perfectly fine that I don’t even think it matters how D&D does it.
Saying that NPCs “must” be created a specific way is clearly incorrect in the broader category of RPGs.
Sure, there are many games that don't generate NPCs the same way as PCs... but also many long-time and relatively popular ones that do so, give or take a few modifications here and there. And there are pros and cons for both approaches. Not following PC rules gives the GM a lot of options at the expense of players understanding what they're facing, while following PC rules constrains the GM while enhancing players' abilities to analyze what they're encountering.
Within the context of D&D, 3e had gone
all in on systematizing NPC building (and monster building for that matter). It was the edition also founded on increasing a player's ability to make informed choices about what they were doing (Skip Williams, for example, has been explicit about this in some interviews). They knew what their skills would do, how DCs were determined, how much stronger a huge monster was compared to a medium one, and some of what to expect from an NPC if they started to exhibit certain powers. System mastery was about a lot more than picking good build options for PCs. And if you dug that, 4e throwing about half that out the window behind a veil of DMs building whatever they wanted as long as the math worked out in the end was gonna chafe.
And with 5e, there are elements of it that
still make me squint. For example, I know a gladiator (MM stat block) gets 3 attacks and has 15 hit dice to make the math work out as a CR 5 opponent. But I also know that a fighter doesn't get that kind of attack ability until 11th level and has different assumptions on other powers and hit points. AND I'm encouraged to use that stat block (as a DM) for any number of NPCs a PC may encounter while not being called a "gladiator" at all because it offers a similar kind of challenge. In other words, on the player side of the DM's screen, I pretty much got a lot less to make any informed decision on other than "the math".
Whether you prefer one approach over the other may be a matter of taste. But it's a notable difference in approach that's going to generate some debate. Perhaps even more so when that difference in approach manifests itself in edition changes for the same game.