Sort of. We can't make a contract to do something that would otherwise be illegal. A very simple example is that I cannot put into a rental lease that I can evict a tenant in 5 days. That would be in conflict with the law that says I must go through a 30 day process. Even if I put it in a contract and you sign it, you can still sue me for not going through the 30 day process.
Right, there are laws that govern certain types of contracts. I think the problem there is that a lease is regulated, rather than contracts in general. As a counter example, the contracts that members of sober living houses sign indicate that they can be expelled for relapse without going through a formal eviction process. These contracts are governed by a different federal law (the 1988 amendment to the federal fair housing act, IIRC).