Tenants could ask for contract terms that forbid such raises.
Or, if landlords are not forthcoming, they could take out insurance.
And yes, such insurance would need to have its terms written carefully. And it probably doesn't exist as a product at the moment. But eg sponsoring the development of such insurance would be an easier to justify action by the government than a law. Also less likely to backfire.
In any case, the underlying problem is lots of pent up demand for building, and permits only being given out in a trickle. If there was more building, landlords couldn't pull those tricks, at least not profitably.