Because they calculate they are more willing to do that than the tenant is willing to move. It only costs them a month or two of the difference in rent they are going to charge a new tenant. They still make thousands more in the end.
Meanwhile, the tenant has to pay more money to move than it costs the landlord to rent the place again. The landlord knows they so they offer an extension at an increase of about the same amount it would cost to move.
They are betting they can do absolutely nothing and make more money. Even if they lose that bet, they still make more money.
There is zero downside when there is high demand for housing and other landlords are doing the same thing.