Isn't that an example where the market alone could solve that problem, without needing a noncompete? If you were paid 500K to build it, and what you learned makes you worth 1M to a competitor, how are you not worth 1M+ to your current employer?
If all your current employer wanted was to get a head start in the market, they let you walk for the 1M. If you're still providing them great value and/or letting their competitor in on it would be worth more than that to them, they can beat the offer.
Maybe you'd have separate reasons for wanting to leave (though "I want to reimplement the thing I just built again" doesn't seem to be the most common reason to leave a place), but in that case why are the company's reasons more important than your own, to the point that they should be legally protected?