I think two big missing factors in your analysis are (1) profit — US drug companies pocketed something around $30 billion dollars this year, and (2) inefficiency - something like $20 billion dollars went into deg marketing in the US for example, which seems to me like almost a complete waste.
And marketing includes things like paying a sales rep to answer doctors questions. Are you saying they shouldn’t do that.
Personnel can be a big chunk as well, since the fully loaded cost of a sales rep can be $400k per year and for primary care drugs, it’s not unusual to have 1,000 reps.
So the only incentive to do maximal good is more money. And people wonder why I laugh when it's claimed that we live in a civilized society.
The mandated motivation for a corporation is to maximize share value for it's shareholders. That's it, as creepy as it is. CEO's (well "good" sociopathic ones) compartmentalize everyone's jobs so they only do the little bit of bad that they are comfortable with and can distance themselves from the corporate wrongdoings, as a whole.
A singular person, or even a small group of people, have entirely different dynamics and motivations and would, normally, never make these type of decisions themselves. Singularly, they wouldn't be able to run successful multinational, billion dollar corporations either.
It's somewhat unfair to look at a single person who works at one of these companies and say that they are the downfall of society anymore than you could point to a singular person in Roman history and say, "There. That guy. He caused the downfall."
That's actually not the case. It became dogma in the 1980s but there is no legal mandate for this.
Like, you could imagine a system where you don't have a free market at all, the government would directly fund both medical treatment (like in Europe) and medical research (like nowhere right now, but you could imagine nationalizing the drug companies). So then, before the hepatitis-c drug exists, you are paying $500k for each liver transplant, and you try to figure out how much money should be allocated to that drug research program. You'd want to fund it at roughly the expected cost saving, multiplied by the probability that the drug development is successful.
In the actual system, if the drug companies try to develop the drugs, and then charge about the same price as the cost of the previous treatment during the time they hold the patent, then their expected payoff (so how much money they will put into research) is the cost of the previous treatment times the probability that they will be successful---so this high price is basically what we would want to allocate anyway. And if the drugs are paid for by the government, their expected spending over all the drugs is similar to optimal amount of direct research funding.