Pharmaceutical companies and their generic competitors, often courtroom adversaries, are fighting on the same side to protect their right to settle patent disputes out of court through cash payments.