No, a contract is not simply a contract. Contracts are only enforced when a court agrees they are enforceable. A court can declare a contract unenforceable for a variety of reasons, such as if it was ill-formed, one side was overwhelmingly more powerful, or the contract is against public policy (such as non-compete agreements in California).
https://www.nolo.com/legal-encyclopedia/unenforceable-contra...