Before patents, scientists wouldn't share their findings. Patents are an excellent way of making things public domain 20 years later.
We should have the same with software.
Why? Open source is doing fine.
Instead of patents, the government could just pay scientists who make useful things. Sure it costs government money, but so do the lawsuits.
Or just don't protect trade secrets (the entire point of patents is that trade secrets are harmful to society), and require all software to come with source, the right to have someone change/fix it for you, and the right to share your changes/fixes under a right-to-repair umbrella. Maybe retain a limited (e.g. ~5 year) distribution monopoly on the original (so you could distribute patches but not the full thing).
Source is less important with LLMs now, but it's wasteful and destructive to the planet to have everyone need to use them to reverse engineer things for no reason.
An economy built around not making knowledge prolific is obviously a bad, inefficient idea, and in the end will be our downfall.