If a couple make a valid agreement, the court can still set it aside if it would cause a serious injustice.
If the court finds the agreement would cause a serious injustice, it has two options: set it aside entirely or leave it in place. There is no way a court can keep the parts of the agreement that are fair, but remove the parts that would cause the injustice.
It is rare for the court to find that an agreement would cause a serious injustice. The court will often recognise that the partners wanted to be certain about how to divide their property and allow their agreement to stand.
Would it be better if the court could vary the partners’ agreement? If it could, the court could salvage the things the partners agreed on, but remove the problematic parts of the agreement.
People will often make agreements because they think the whole bargain is fair. If the court changes parts of the agreement, it could skew the bargain. People will probably want confidence that the entirety of their agreement will always apply.