At least we agree on that much. My point is that when the patent is preferable (in the vast majority of cases, as you say) it implies that a trade secret would not have been expected to last as long as the patent—which makes the patent strictly worse from the public's point of view. We've granted a 20-year monopoly in exchange for revealing information which would have otherwise become public, without restrictions, in less than 20 years.
Maintaining tight control over the distribution of the drug only gets you so far, especially when the underlying research is already public knowledge. Trade secrets, unlike patents, don't block independent discovery, and only the rarest and most expensive drugs would warrant complete control over the supply chain.
As for the incentive to perform the research, that ultimately comes from the patients desiring treatment, not the pharmaceutical companies. Eliminating the monopolies would not reduce the demand for treatments, though it would reduce the profitability of individual pharmaceutical companies.
> You can easily construct a counter example where a drug has a greater than 50% chance of remaining secret during the length of the patent, yet taking the patent has a greater expected value.
Yes, if you are not confident that you can keep a trade secret then the patent becomes the better option. (Isn't that what I said before?) "Greater than 50% chance" is not what I would call "confident". It doesn't change the fact that patents only have a positive net expected value to the recipient in the situations where the public is expected to lose by granting a patent rather than having the knowledge kept as a trade secret for a time. The interests of the applicant and the public are diametrically opposed; if the patent applicant wins, the public loses.