Arguably capital gains should be paid earlier so it’s a sunk cost. Being able to put it off is market-distorting. It’s hard to come up with a fair way to do it though.
Maybe a requirement to save money in advance based on market price, like payroll deductions? Then once you actually sell, you might even get a bit of a refund, encouraging turnover. But that would affect people with cash-flow problems the most.
And the biggest problem is that many people don’t want to sell and will resent any attempt to encourage it. Because encouraging turnover is equivalent to penalizing people who stay.
There is no “natural” way to do this, anything can be considered a market distortion depending on your point of view.
For large residential buildings in California, I’ve heard that apartment owners will essentially swap buildings for some kind of tax advantage. (I forgot what it was, though.)