This is something of a nitpick but:

Apple did not lose a legal ruling. Some companies initiated a lawsuit against them, and Apple and those parties mutually agreed to resolve their dispute, presumably with concessions from both sides. The agreement needs to be approved by a judge, but the parties in the case are saying that they are no longer in dispute under the proposed terms.

Companies that get sued agree to settlements all the time, even if they believe they are fully in the right, because going to trial has a large potential risk; and the legal expected fees for litigating a trial and possible appeals might exceed the cost of the proposed settlement.

If the party suing you is willing to settle for known terms, then it might be preferable to accept the (undesirable to you but fixed and known ahead of time) costs/downsides by settling, than roll the dice by allowing the case to proceed to a judge or jury trial where you might indeed lose the case and suffer a much worse outcome. Companies might settle if they think there is some chance that they plaintiff might prevail, even if that chance is low, when there could be a large (potentially unbounded) downside to losing the case — as could be the case for a class action.

This is the same risk management reasoning that allows patent trolls to get away with their bullshit. If you don’t think their patent is valid and would survive scrutiny in court, and even know of prior art, or you don’t think you are infringing it, the legal costs to litigate an fight that battle in court might be higher (and take years of time and energy from senior staff members of the company – a distraction) than settling with the patent troll for what they’re asking for to “license” their patent.

It was a travesty that trolls got away with it for so long, but computers and software historically were new whereas most judges & juries consisted of older individuals, and know little to nothing about the internals of computers & software. Meanwhile both sides could bring in so-called expert witnesses to claim whatever they want.

This asymmetry resulted in some tech companies agreeing to pool their patents, and formally or informally agree not to sue each other over patents, and form mutual defense coalitions. The Supreme Court also tightened up what inventions are patentable in the software space considerably, as I recall, to eliminate the “pure abstract idea implemented in software and running on a computer“ category of patents.

Judges are also starting to become more tech savvy and specialized court circuits are developing to focus on the area. Take a look at how Google versus Oracle was handled: the judge assigned to the case learned introductory programming (!) so as to assess whether Oracle’s claim about their code snippet being copyrightable was true, vs. being obvious and something any practitioner of the art would necessarily write when building compatibility with the Java API (which he did end up concluding as I recall; definitely correct decision IMO, if you recall what that function was – something like checking whether a given index was within the bounds of an array or something similar; any function to do that will look about the same). The case was appealed and I haven’t kept up-to-date on it since then.

As the holder of several patents myself, I personally think only substantial research breakthroughs should be patentable (where it comes to software patents that are essentially pure algorithms). The MP3 algorithm was a complete game changer for music & audio distribution, for example, drastically reducing its data size and making it feasible to economically transmit over the Internet. Breakthroughs of this magnitude ought to be the minimum bar in my mind, that I would want the patent office to hold for software patents personally. A novel way to organize your CRM database should not be patentable.

A secondary problem is that the patent office has no incentives to be strict (after all, they can just issue the patents and let people litigate in court if they think it’s wrong), and I doubt their competence in their ability to evaluate whether a claimed invention is worthy. they also make income from the patent submission process so their incentives are to allow companies to submit a lot of patents; and if they made those patents too difficult to get, companies would not bother, relying on keeping inventions as trade secrets instead, which companies by and large are doing anyway.

A final travesty is how many patents don’t disclose any useful information for someone to replicate the invention when the patent expires. As compared to patents for mechanical devices that must include diagrams of functional machines, software patents have hand wavy abstract architectures that would help you little if at all in your efforts to duplicate the “invention“ after the patent expires.

All right, it looks like I’ve gone off on a rant. Suffice it to say that the legal system has lots of complicated incentives and motivations influencing parties involved in it. There may be numerous reasons for a company to take any particular course of action in a legal dispute.