You raise a good point. However, the utility of something that's patented is that it (ostensibly) solves a problem. It's a way for an inventor to say "I/we figured out how to do X in a way that's novel and unique to me/us". In the spirit of the patent, the actual method for solving X is detailed in such a way that its uniqueness and utility can be independently verified by experts. The actual patent application is public domain so other inventors can figure out another way to solve X or make sure they don't violate someone else's patent inadvertently. The opportunity to skin the cat differently provides a spur to innovation. As an incentive to sharing this knowledge, the government provides a time-limited monopoly for the inventor to leverage the patent for financial gain. Moreover, a patent cannot be granted for a problem that does not have alternate solutions.
In the case of software, the "problems" that the solutions solve have gotten too large or broad. Instead of a single novel way for compressing audio, you get a method for end-to-end streaming music that gets patented. We may be better served if the patent were denied on the basis that the problem is "too large or broad" and the patent needs to be broken up. A good (and requisite) car example of this "too large or broad" application would be Tesla patenting their entire Model S sedan under a single patent. The components of the Model S solve a multitude of problems (propulsion method, vehicle management, secure APIs :), etc.), but patenting the entire car would never happen, and, in fact, the car's components are individually patented. The same standard should be applied to software. Break the software up into its component parts and have those patented individually or not at all. (I realize this would likely result in a deluge of patent applications, but forcing the source code for the solution to be included in the patent would make a huge difference here.)
A completely separate problem are that many patents are granted and the inventor(s) simply sit on the technology. Such a failure to actively attempt financial gain from a patent should be grounds for invalidating the patent, but that's a separate vein entirely.