We already have special treatment for capital gains in the form of a primary residence. No reason that couldn't continue.
The exact rules could be tweaked to keep it from being a burden on families taking a second mortgage, e.g. if you borrow less than a certain amount in the tax year perhaps the rule doesn't apply. Use your imagination.