Medallions don't come out of thin air. It's the cities that provide them. The cities want this, because taxis are meant to be a component of the city transportation system. They're not there to compete with public transit, they're there to augment it - to service the needs that a bus or a train can't. A medallion comes with a requirement to fulfill those needs, as the city sees fit.
The relationship between public mass transit, and private taxis (and private mass transit) was cooperative. The relationship between city transportation systems and Uber is hostile.
The cities don't provide medallions, they mandate them and limit the supply. The default state without the city's intervention (i.e. no medallions needed to operate a taxi) is equivalent to having a superabundance of medallions. As you say, they do this in order to bring taxis in line with their plans for city-wide public transportation. Which is not to say that they wouldn't discard the medallion system the moment something better came along to fulfill a similar role. The city has no particular interest in maintaining the market value of the medallions; they remain scarce only because the city prefers to limit the number of taxis on the roads, and as a concession to the taxi industry so that they will acquiesce to the city's rules with less of a fight. If demand for taxis drops below the number the city is willing to tolerate, for whatever reason, you shouldn't expect the city to prop up the value of the medallions just because you're counting on it as your retirement plan.
The relationship between public mass transit, and private taxis (and private mass transit) was cooperative. The relationship between city transportation systems and Uber is hostile.