My understanding is that if the lender forgives the debt, the amount forgiven is considered income.
Yes, that is correct. If you lender foregives your mortgage balance, that balance is then considered income to you.
Federal law exempts the sale of a residence. If it was your rental house that was forclosed, then you’d be taxed on the forgiven monies as income. Primary residence, nope.