The problem at a fundamental level.... is Continual Flame.
Or put another way, the issue is less about the accumulation of coin than it is the accumulation of wealth. In actual medieval societies, the vast majority of things are degradable. The servants...die. Livestock....die. Your crops...die or are consumed. Most things produced require an incredible amount of effort just to maintain year to year and generation to generation.
So the wealth is in the permanent stuff, the land being the principal one (and the buildings on them). When you have land you have wealth, because the land is there generation after generation, the key to production. And land is limited, there is only so much of it, so it you have an innate supply and demand constraint. Everyone wants land, very few people get to have it, and those are the wealthy people for the most part.
Magic use in itself is just another form of labor....skilled labor to be sure...but labor nonetheless. Magic users have to be trained, they have a certain amount of productivity, most of them probably never amount to beyond 1-2nd level spells at most...and then eventually they die. Its an important and powerful resource....but still a limited one at an economy level. Now if magic is easy to learn...then schools and education programs can markedly increase that resource. But dnd suggests that spellcasting is just really hard to do, and it takes a certain person above and beyond the base intellect to really get the hang of it. So again, a limited resource.
But once you get into magic items...its a brand new ballgame, continual flame being the most basic example. Now we take a consumable labor resource and convert their time into generating a permanent magical benefit. That is not just a resource...that is WEALTH. That is a benefit that can be cultivated, stored, and built over time. A community starts with a handful of continual lights. Fast forward a generation....and the entire city is fully illuminated.
Permanent Magic items shatter the feudal economies that dnd would seem to simulate at first glance. Therefore, your first step to making an economy realistic....permanent magic items have to go. Either they are gone gone, or they require expensive recharging periodically, they fade to nothingness after X amount of time...etc.