Quality does not rhyme with popularity.
Take the VHS vs Beta recorders. Beta was the better product. Way better than VHS but... Beta had two hours or recording and VHS 6 hours. Guess which one won?
The same can be said with fast food and good quality restaurant. McDonald is quality fast food (even if these two concept do not go well together) but it will never beat the quality you will find in a five star restaurant. And yet, which one makes the most money? McDonald's by a large, a very very large margin.
I don't care for McDonalds and haven't eaten there this century. On the other hand, McDonalds has extremely high quality control standards. You go into a McDonalds and order a Happy Meal and it will be a Happy Meal whether you're in Fairbanks or Miami. You'll also know that the place will be well lit and clean. On the other hand, while I don't eat out often I do enjoy a burger at Culver's now and then. For me? A burger and a shake on average has been more satisfying and enjoyable than highly rated expensive restaurants I've tried. So for me, by and large that burger is a higher quality. There's no accounting for taste.

Just like most people can't tell the difference between an $18 bottle of wine and a $3,000 bottle of wine.
And music? Everyone knows that the music in classical and heavy metal is richer than rap, hip hop and pop (and I love hip hop and pop). But which one are the most popular? Here, the formers need way better musicians than the laters and yet, the laters sell quite well.
So ... classical music is higher quality because you say so? I would say that they're
different, it doesn't make one higher quality. It depends on the goals of the people making the music. For one person Wagner might be da bomb, for someone else it might be Rhianna. While Rhianna isn't on my Spotify list personally, she has very high quality production and concert standards. Many bands hit big and then flair out because they simply can't sustain a quality product. Whether that's because they were one-hit-wonders who just happened to get lucky or because of personal issues with the performers.
When it comes to 5E, if it wasn't a popular product they would have been like one-hit-wonder Blind Melon or Nickleback who were big for a while but had so, so many issues.
The analogy works as well for D&D 5ed. Or even D&D in general. The fact that it sells so well does not mean it is top quality product. Who beside me had to repair their 5ed PHB because the books were falling apart after a few months of using? I know that I am not alone because I repaired quite a few for friends. My three PHB had to be repaired including my MM. There is more to quality than the system. They have improved but the simple fact that many PHB, MM and even DMG had to be repaired can be an indication.
If your books fell apart you should have sent them back for new ones. I did (twice, different books) and not only did they replace it with no questions asked and no receipt, they also sent me an additional product as well. I agree the printer of the books wasn't great quality but their customer service was quite high quality.
But the system of 5ed, in general, is of really good quality. There are very few things that bugs me (the bard, the sorcerer, the monk and beast ranger for example). Few things in the rules do not make sense (no punchy smithadin...), the removal of alignment and the coming back (sort of) or simply the addition of floating ASI at large where only the +1 would have suffice... At launch, 5ed was great. Now... well, the direction is quite opposite of what I do want, but does that make the product of less quality? I do not think so. But it does make it less in line with my personal (and my table's) preferences. There are RPGs out there where the design is more consistent and dare I say, of better quality? But they are not as popular as D&D.
Yeah, nothing is perfect. I'm not saying 5E is the highest quality RPG of all time because I don't know how you would measure that. But 5E seems to be a quality product for millions of people, more people play every year. For a game when there's so much competing for our spare time to accomplish what 5E has to me indicates that for a lot of people it is a quality product.
People have voted with their dollars and time.