During the Punic wars and Peloponnesian wars cities would be put to the torch, with the men being slaughtered and the women and children being sold into slavery. I haven't heard of this being a common thing in the medieval ages, where sacks might have been gruesome but were not a death knell to the city. When and why did this change?
Realistically, not until after the Second World War.
The razing of cities was actually a fairly common occurrence throughout most of European history until after 1945, and the concept itself wasn't really done away with in its entirety until the formation of the European Economic Community and its gradual growth, mixed with the rise of pan-Europeanism, made it a practical impossibility. Although, that being said, there have of course been exceptions, like the bombing of Sarajevo during the Yugoslav Wars (mind you, that wasn't quite the same as actually razing a city).
After the Western Roman Empire collapsed, the razing (or more specifically, the sacking) of cities was actually a fairly common occurrence during and after the Middle Ages. Paris, for example, was sacked in 845AD by Viking raiders. The same happened to Rome in 1527AD, when it was sacked by German Landsknecht mercenaries. In the modern period, much of Moscow was burned to the ground in 1812 as a means of weakening Napoleon's invading Grande Armée. And as recently as the 1940's, many cities were bombed to rubble, notably Berlin, Dresden and Stalingrad.
And those are just a handful of example. There are many others from the post-Classical period.
I would suggest that what you're asking isn't so much about the destruction of cities, as such, but the destruction of ethnic polities. When the Romans razed Carthage (to the extent that they did so), the intention wasn't to destroy the stone buildings and agricultural hinterland; it was to destroy the cultural unity, the identification "we are Carthaginians" that had made it possible to mobilise the population of that city and area to their long struggle with Rome. In modern times - even in medieval times - there have not been any serious powers with a "catchment of identification" as small as a single city and its hinterland. (Some of the Hansa cities, perhaps? But they were never on the losing end of so bitter a war.) So the equivalent in post-classical times is, I think, genocide. People didn't stop razing cities because it became unacceptable, but because cities were no longer a reasonable size of target if you wanted to destroy an identity group as a source of resistance. Instead they attempted to destroy entire ethnicities, or religions as in the Albigensian Crusade - which is noteworthy for being the source of the quote, "kill them all, God will know His own" - referring to the population of Toulouse!
Having made that identification, we can note that genocide was never "acceptable"; everyone roundly condemned it when done by someone else. Which, of course, is not to say that it never happened, even in Europe in modern times; the civil war that tore Yugoslavia apart "ethnic cleansing" being pursued as a deliberate policy.
I would say that even in such brutal conflicts as the Thirty Years War, outright razing a city was still not considered an acceptable thing even though it very much happened. The Sack of Magdeburg in 1631 would be an example, a city of thirty thousand people was virtually destroyed after it fell to assault and the victorious army ran rampant.
This was absolutely not something viewed as 'acceptable' however, the Sack of Magdeburg was infamous, decried even by those on the same side and used as an excuse by the Protestants to massacre prisoners in retribution for years afterwards.