I think it's always dangerous to say "D&D doesn't work like the real world" because that's not it's goal. Look at the whole "what's a gold piece worth" argument. Based on real world economics, a gold piece doesn't make a lot of sense, but we're talking a fantasy world not our reality; maybe gold is simply more plentiful but still scarce enough to be valued.
But when addressing this type of issue I try to do a logical "what-if" analysis. What if magic were real? What impact would it have?
D&D has all sorts of tropes and this one is a major one. Technological stagnation.
First, I have to admit I think the worlds with any line like "this tower has stood for 10,000 years..." is silly. Some elven civilizations might be able to make that claim, but a human civilization? Probably not.
So I don't assume that technology has been stagnant for thousands of years in my games. That doesn't mean that in the long run there will ever be an industrial revolution.
Let's take gunpowder as an example. Gunpowder was invented in the 9th century in China, but for a long time it's use was limited to bombs and simple rockets, it wasn't until the 15th century that we started using artillery and it wasn't until the 17th century that firearms were widely used. We tend to look at gunpowder and think only of modern firearms, but there was a long, long evolution of the technology. The first cannon would have been relatively inefficient and incredibly expensive when compared to what a moderately well trained war mage could do. Want to make things go boom? Get a mage and stop messing around with that flash powder.
In addition, I could see simple spells that could be used to ignite an enemy's gunpowder from a distance. After all a simple spark spark that would do no more than annoy a person would be enough to set off a keg of gunpowder. Then again, maybe the chemistry of gunpowder simply didn't work.
What about steam engines? Well, the first steam engine experiments on record were in first century Rome, it wasn't until the 17th century that we had anything that really worked. So even assuming the physics of a D&D world are similar enough to allow steam engines, that's a pretty big gap. But what if there were other issues? Would steam mephits look at a huffing-puffing steam engine as a mating call? Or could something that comes close to being a living creature spontaneously come to life? Have a few threshing machines develop a taste for flesh instead of wheat and they'll be banned pretty quick.
So where would the technology stagnate? Well, most D&D worlds assume we have pretty advance metallurgy. Plate mail is fairly common (whether anyone would wear it constantly like PCs do is a whole other question). Swords are not limited in any way to available material. Which makes sense for a civilization that has relatively advanced technology other than firearms and steam engines. The reason metal armor went out of fashion (and has now been replaced by kevlar and ceramic plates) is because of firearms. No firearms, not reason for metal armor to become obsolete.
Cheap paper and printing presses (cheap paper actually came first, no reason to develop a printing press if you can't afford to mass produce the books) could still be common. Advances in medical treatments would just be another type of healing magic.
So with a few logical assumptions, basic fantasy tropes do make sense.
The other trope is that civilisations get destroyed and everything collapses
In fantasy worlds you have magical cataclysms, and sometimes the victors are not interested in the conquered civilization's technology because the victor isn't always human.
I
do think FR has seen way too many world-ending cataclysms. The "the world will end unless a hero/group of heroes can stop it" is far too common a theme IMHO. Threats to cities or regions? Sure. That would be cataclysmic enough. But a threat to the entire world? Meh. Not going to happen often.
However it can happen. One thing in my campaign is the idea that there was the equivalent of a magical nuclear war long ago, in part to justify ancient ruins and artifacts. In more recent times, some mages tried to re-invent the "magic nukes" and the gods put an end to the entire region.
Anyway, just my 2 coppers. Kind of fun to think about - what would the arc of history have looked like if we had magic but no gunpowder or steam engines?