I think a huge part of 5e's success is that it was given huge boosts by other media. The popularity of Critical Role on internet streaming, D&D being placed in popular main stream shows like The Big Bang Theory and Stranger Things, and more all contributed to shifting D&D out of a small niche group and into the mainstream.
When you add many millions of new potential players by going from niche to mainstream, you add the ability to grow your sales for a long while. The small niche group would quickly buy the books it wanted and then you didn't need a second or third PHB or DMG unless you destroyed yours somehow.
It's entirely possible that 3e would have done as well or better if it had been the edition released as D&D went mainstream. Or maybe it wouldn't have. There's no real way to know. That 5e is a well made game doesn't mean that the quality is the primary reason for 5e's success. For sure it's a big reason, but we don't really know where it ranks with the other large variables involved.
I don't think 3E could ever have done as well as 5E. There was too much of a barrier to entry for effective characters and the game fell apart at higher levels. Both of those issues have, by and large been fixed. I enjoyed 3E, but then again, I like reading through options and figuring out combinations that will work well even if I don't consider myself a power gamer.
Since PF was basically D&D 3.75, if it had really worked for people I see no reason why it would not have taken off.