This is simply not true in the same way that consumers are not always rational and always pay the exact correct price.
Landlords regularly charge less than full market rate, for example when they have a good tenant, as the costs of a new tenancy and the risk of a void are higher than the incremental marginal rent (once taxed at the landlord's marginal rate) is worth to that landlord. Unlike what most people seem to assume, being a landlord is not a zero-labour job. Things that require additional labour on the part of the landlord have to be worth it.
The thing that changes this calculation is an increase in costs. You are right that landlords are not charities, so they will generally avoid a loss. The primary costs for most landlords are mortgage interest and taxes. Increase the taxes and some of these landlords will now be underwater and will increase prices towards highest market rate as a result.