Machines aren't patentable because they do stuff: they're historically patentable because new ones take a lot of work to create and they can easily be reverse engineered and copied, so they're patentable because of the pragmatic tradeoff that says that society will be better off if machines are patentable, because it gives people an incentive to create and share knowledge, knowing they won't be stolen. That same justification applies to why pharmaceuticals are patentable: it's a huge amount of work to create a new one, and once they're created they can be copied for a fraction of that amount of work, so without patents people won't research them. Machines are pharmaceuticals are in no way isomorphic in that they do the same sorts of things, but they do share the same sorts of qualities that make patents a net win for society.
Software doesn't share those characteristics: the difficulty of a given software "invention" tends not to be high (except for things like compression or crypto algorithms), similar "inventions" are likely to be arrived at independently, copyright and trade secrets protection work well enough to motivate people to do it, and outright duplication of a program without stealing source code requires a significant amount of work due to the size of any complex program. (i.e. you can try to copy photoshop down to the last behavior, but it's going to take about as much work as writing photoshop took).
Therefore, I don't believe it's to correct that since you can replace a machine with software, and the machine is patentable, therefore the software is patentable. The machine isn't patentable because of what it can do, but rather due to the inherent qualities of mechanical inventions, and those are things that simply don't apply to software.