Sometimes one side will skip the attempt-a-settlement phase and just file suit. Why should the second party be barred from seeking a settlement? A settlement means that neither side will have overwhelming legal expenses, and it takes a load off the courts. Remember that filing suit is a unilateral action, and I can "go to court" completely unwillingly.
Your second paragraph misses any point I can discern. Assuming the story is as presented, the leak came from nobody with a contract with Apple, and so contract law is inapplicable here.
Let's go through this slowly. A court ordered Apple's lawyers to provide certain information to Samsung's lawyers. In this case, it was patent deals. It could have been any confidential information. Apple's lawyers complied with the legal order. So far, Apple is simply complying with the law, and indeed not supplying that information to Samsung's lawyers would have been illegal. Since Apple has been legally compelled to reveal confidential information, the court system needs to have some way of protecting that information.
If we make Apple responsible for keeping its secrets, then Apple can avoid supplying any information it can reasonably describe as confidential. This means that civil suits are nearly impossible, as discovery simply doesn't work. If we make Apple hand over confidential information without protecting it, then no company can reliably keep confidential information, since anybody can file suit and ask for that information in discovery. The only way a company can keep information confidential while still allowing civil suits to go on is to have court orders to produce information and court orders to protect information. If you have a reasonable idea on how to avoid those problems, please let us know.
If you don't like that reason for private agreements, how about this one? Any business transaction that isn't the equivalent of cash-for-stuff involves a contract. A commitment for one side to do something in the future involves a contract. That includes things like magazine subscriptions and website subscriptions (contracts do not have to be particularly formal). Now, suppose you subscribe to Furry Porn Quarterly. If all contracts are public record, then anybody can ask for their subscription list. Alternately, imagine that somebody brings suit against FPQ, Inc., making claims relevant to the subscription list. Furry Porn Quarterly is therefore ordered to hand over their subscription list to the plaintiff's lawyers. With no restriction on them, those lawyers can then publish the list