Whenever something like this comes up, R&D is held up as the "cost center", whereas initial discovery (hit) or optimizing it into a "lead" molecule is a fraction of the cost of turning out a "drug", even manufacturing is a comparatively small expense. The majority of the cost lies in the clinical trials process. That is where a potential drug can fail and take everything down the drain. That is why the "fail-early, fail-fast" mantra has been ingrained into big pharmacy like gospel truth. However, there is no reliable predictor of "late stage" clinical trial failures for a candidate drug molecule. And trials can fail from a drug having statistically insignificant improvements in a group of target patients, all the way to, having a high (how high?) propensity for adverse effects in the patient group.
So, the solution? More fundamental research to explore indicators of late stage failure, coupled with "cheaper" clinical trials to justify a lower development cost that is enforced by legislation to bypass greedy execs/shareholders. Now, those "cheaper" trials, that is whole 'nother can-o-worms for a different thread, because it involves our willingness, as a society, to accept such risks as are part of the discovery process.