In your example, the "ethical" way to violate a non-compete is to redact it from the original contract.
I'm not saying you're the worst person ever, but littering is unethical, and so is saying you'll do something and then not doing it (or vice versa).
I'm sure you're thinking "but we're talking about software jobs where people have a lot more choice and bargaining power", which is definitely the case, hence why I mentioned that it depends on the company. On the most unethical end of contract violation I'd put the small startup that treats its people right and on the other end I'd put Walmart.
What the person in your Jimmy Johns example has is the ability to seek work elsewhere.
They are indeed acting unethically if they choose to work at Jimmy Johns, knowing what Jimmy Johns requires of its employees, then proceed to quit and then go work at Subway.
I'm concerned you're considering "acting unethically" as a kind of condemnation. It's not. Life happens, and nobody's being sent to the stockade for acting unethically, but that is what you're doing when you violate a contract.
I would add that ethics is an entire branch of philosophy, so you know, there's so ambiguity between different folks' definitions. IMO it is ethical to violate contracts that would cause undue harm to one of the parties without good cause and furthermore it is unethical for a party to ask another to sign such a contract. And working at another sandwich place is not good cause. Clearly in your opinion you think it is unethical to violate such a contract because you appear to believe that violating any agreement (almost irrespective of context) is unethical. I'd be curious if you think that Jimmy Johns is ethical, unethical, or neutral for inserting such language into a contract in the first place. I would strongly disagree with that being either neutral or ethical.
Not that the US government is an arbiter of ethics, but Jimmy Johns has dropped their non-competes in several states after state Attorneys General filed suit against them: https://www.cnbc.com/2016/06/22/jimmy-johns-drops-non-compet...