It may always happen but it would happen less if we updated patent laws to fine people who filed invalid patents or enforced some kind of similar punishment. If you file a patent, it's up to you to verify that your patent is actually valid, and the courts shouldn't have to do that legwork for you. It also doesn't help that the patent office/components of governments don't review patents as thoroughly as they used to. Same with trademarks.
Even better, software patents should not be allowed in the first place.
Why patents is a problem, please explain. If you build something that has been patented, then, well, you pay the per piece fee on it.
I generally don't like the current patent law but it sounds a bit off to pay the government & wait for them to review your patent claim and then get fined by the government when both of you were wrong about it. There are already processes to additionally fine a company bringing about a truly frivolous patent lawsuit, it's just rare because usually it's not so cut and dry as we'd like it to be.