So no, a noncompete - even one that only applies to the time you are employed by the company - isn't typically necessary.
Confidentiality doesn't work that well because proving that a former employee disclosed proprietary information is very difficult.
However, the ex-employee is generally paid at full salary for the time that they're unemployed, which seems like a very fair arrangement all around.
My friend did commercial banking. He had a one year non-compete, but it was geographically scoped, and he also had multi-year contracts that protected him from layoff. They needed to release him for specific causes, buy out the contract, release his contractual obligations, or some combo.
Usually it depends on the exact new position, whether it's at a direct competitor, how senior the person was, etc.
Why is the politico-economic system called "capitalism" and not "laborism"?
You have to take pains to avoid contamination when reverse engineering a product, for example, and that doesn't even involve the original staff.
Seems that your argument could also be used to justify lifetime noncompetes. If I work for a company, gain experience, then go work for another company, they're getting the benefit of all of that experience without having to pay for the years it took to obtain it.
The value of this, of course, depends very much on the specific industry and project. It doesn't really matter if your guy who builds generic websites for your clients also builds generic websites for a competitor's clients. That doesn't materially hurt the first employer. But it can matter a lot if your guy who you are paying to develop cutting-edge algorithms is deploying those algorithms to the competitor you're trying to beat. Instead of gaining an edge worth $X per year, your company instead gains only part of that advantage because at least one competitor is cutting into it.
At least one of the reasons for a non-compete clause is to make sure you're not doing stuff on the clock for your employer, and then getting double-paid by a competitor for essentially the same end result but without the competitor having to pay for the whole process of getting that result. Like, if they're paying you to spend 40 hours a week learning about the key problems in their industry and designing and implementing solutions, and then a competitor hires you for 10 hours a week to re-implement those solutions (not paying for the learning/designing phases). So the competitor is getting the benefit of work you're doing that in some sense should belong to your main employer.
There might be something better than a non-compete clause for that sort of scenario, I just don't know what it is.