I agree that would be ideal, but realistically there's usually a pretty big power imbalance between someone seeking a job and a potential employer. I'd say that how ethical it is varies depending on the company. For example, Jimmy Johns has non-compete agreements. Someone working at Jimmy Johns has 0 ability to negotiate that. Are they unethical if they quit after a year or so to go work at Subway? I would say obviously not, maybe you'd think they are.
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.
No; this is simple, if difficult. If you want to be ethical, you cannot sign an agreement knowing what it says in full, and then violate that agreement when the counterparty has operated in good faith.
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'm not worried about "acting unethically" being a condemnation, but IMO actions taken in a vacuum can't really be judged to be ethical or unethical, which is what it seems like you're trying to do when you state that violating any arbitrary agreement is unethical. In fact I'm not sure you really fully believe this, since you add the proviso "when the counterparty has operated in good faith".
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.