It's up to the judge to decide what is valid and not. The court has the power to decide on each clause individually and the contract as a whole.
It's the normal outcome that when one minor clause is deemed invalid, only that clause is dismissed, not the whole contract.
It doesn't costs anything to write it down to clarify. That's exactly why it's written in every standard contract. There could be a different jurisdiction somewhere one day that decides to invalidate entire contracts by default for any stupid reason, I don't know of one in the western countries but I suppose it's possible.
It is reasonably predictable for most situations how a judge would rule, which is why contracts have common boilerplate.
In the event that one part of the contract is nullified, it's up to the court to determine if that modification will nullify the contract or not, it depends on the circumstances.
The presence of the clause cannot prevent to cancel the contract, the absence of the clause doesn't mean that the contract is cancelled if any clause is found invalid.
If you want to escape a contract, you need to go to court and make a case that the contract should be nullified.
If you want to cancel a part of a contract, you need to go to court and make a case that a part of the contract should be nullified.
They are 2 completely different things. The clause is irrelevant, it's not gonna change your future strategy.