I agree that I am ignoring many things, as this is a limited discussion, and I am only addressing the impact of a law on a single employee, and its ethical ramifications.
Secondly: my second point answers my first.
Markets don't manifest in individual transactions, they manifest as the emergent behaviour of multiple transactions. As others have noted, setting bounds to what can be traded away has proven necessary, empirically, to avoid winding up in a highly non-optimal equilibrium point.
If you're interested in ethical ramifications, I recommend two excellent works on the topic: A Theory of Moral Sentiments and An Inquiry into the Nature and Causes of the Wealth of Nations.
Even that treatment is unsatisfactory as it neglects considerations of short-term vs. long-term trade-offs.
Your example is contrived in that it essentially poses a Sophie's Choice: give up condition of long-term viability A or because of my superior position in establishing and enforcing terms, give up condition of long-term viability B.
The optimum condition would be for no artificial constraint on A or B imposed by the employer.
Your earlier scenario made no sense as their would be no reason to suspect that the 2 employers respective pay and conditions were related you have just presented it as such. Imagine the law were changed tomorrow? Would the high paying non compete using employer suddenly start paying smaller wages? Would they have any employees tomorrow if they did? A freer labor market would be MORE competitive not less there is no reason to suspect that they wouldn't have to pay more not less to retain the same talent.