If you need a loan or so, won't the bank actually investigate if the units are vacant?
Some kind of regulation that imposed an equation that increasingly devalues property from its last rented price the longer it remains vacant would do wonders here at correcting the market distortions. Another way to implement that would be to value vacant properties using the total rents charged over the past 5 years -- so the more vacancy there is in that, the more your total rent suffers.
Lenders can (and should) make this change too. It doesn't even need to be imposed top-down by the government.
The movie “The Big Short” actually does a great job of showing this but for the 08 financial crisis.
The problem arises when predictions about the future don't come true. Like a pandemic lowers the value of living in a city, so the amount of rent you can charge goes down. Do you admit that to the bank and let them change the terms of the loan (or have them foreclose), or do you pretend everything is fine, keep your asking rent high, and hope things turn around before the bank calls you?