Correct, that is wrong. Lenders aren’t stupid, they want to see cash flow. Commercial mortgages will come with terms requiring a minimum debt service coverage ratio (DSCR) to avoid default:
https://www.investopedia.com/terms/d/dscr.asp
If a landlord leaves units empty, their income drops, so their DSCR drops, and the lender can consider the property in default.
That does not mean a lender will foreclose or otherwise take control of the property, they also might not want to get involved. But it does give them negotiating power, and is something borrowers want to avoid.