Let's make some simplifying assumptions.
House prices appreciate uniformly. That is, we don't need to model whether the house you'd buy next appreciates faster or slower than the one you're thinking of selling.
For this exercise, call the capital gains exclusion amount $E and your resulting tax benefit $B. You can use the $500k figure or $250k figure or any other figure that suits your situation.
Call the transaction costs $C. This includes agents' fees etc from both ends of owning a property - fees and so on for when you bought it, plus fees and so on for when you eventually sell it. Assume that $C is a fixed price regardless of the price of the property (unlikely, I know, but these are all simplifying assumptions to help us get a handle on things).
Scenario 1: serial purchase - that is, buy at $X, sell at $X+$E, buy another house at $X+$E and sell at $X+$2E. Gross capital gain is $2E. You get 2 lots of tax benefits (+$2B) and lose 2 lots of transaction costs (-$2C).
Scenario 2: single purchase - that is, buy at $X, sell at $X+$2E. Gross capital gain is still $2E, but now you get 1 lot of tax benefits (+$B) and lose 1 lot of transaction costs (-$C).
So the maths says that the difference is (2B-2C) - (B-C) = $B-$C. That is, if your transactions costs are lower than the tax benefit you get from the capital gains exclusion, then you're better off changing as soon as your capital gains hits the threshold. Otherwise, hold off for as long as you can.
We can extend the scenarios to higher capital gains ($3E or $4E etc, instead of $2E), and the basic premise still holds: you're still better off with multiple trades so long as the tax benefit is greater than the transaction costs.
The rationale is that since you're 'earning' more than the 'cost of trade', maximising inventory 'turnover' makes sense. At some point, though, realistic transaction costs will likely exceed your tax benefit.
Suppose your capital gains are taxed at 20%. Then a $500k gain would equate to a $100k tax. Or putting it the other way, the $500k capital gain exclusion could be considered a $100k tax benefit. Assuming a 6% transaction cost (inclusive of both buy and sell, which you'll need to do anyway), transaction costs exceed $100k at about $1.7M, which isn't very many rounds of buying and selling. If you have other costs each time (stamp duty etc), that just makes it worse.
So to answer your question - the maths says that you can benefit from the capital gains exclusion up to a point.
Disclaimer: the above is not to be construed as financial advice, especially since many factors have been ignored. Please consult appropriate legal and financial professionals before committing to any course of action on the basis of the above.