A fix would be if you use unrealized capital to secure a loan, that unrealized capital amount to secure the loan becomes taxable. Of course that would tax people trying to get home equity loans though.
The problem is that people will always probe the tax code for loopholes that weren't considered. It's a cat and mouse game, except the cat is fat and lazy, and gets paid by the mouse.
Eh, an exception for a primary home is common throughout the tax codes and the like. Just saying you realize capital gains on an asset used to secure a loan (unless it's a primary residence) would cover that without being out of step with everything else.
Sure, a billionaire could then use their $143M estate as collateral on a loan to avoid realizing the capital gains, loophole, but since you can only have one primary home, it's a very limited loophole.
The problem is that people will always probe the tax code for loopholes that weren't considered. It's a cat and mouse game, except the cat is fat and lazy, and gets paid by the mouse.