Vaccines are somewhat different as "drugs". They are typically inactivated virus or bacteria (or fragments of them), so the safety risk is somewhat muted in the sense you aren't introducing something completely new into the body. The risk is still there, but not as much as a completely new molecule.
If you were to test new drugs on terminally ill patients and the patient died, was it the drug? Or did they die form their disease? Sometimes you can, often you can't. When you do clinical trials you're trying to eliminate any many variables as possible by running the trial on a relatively homogeneous population. That's why they do phase 1 with healthy volunteers.
The other challenge is that when human testing goes wrong, it can go horribly wrong. Check out the clinical trial of the FAAH Bial compound where people died. Also, TGN1412.
TGN1412 is a good example. This drug turned out to provoke the immune system in an extreme way. What if it had been tested first on cancer patients and, even with the life-threatening side effects, it worked as a cancer immunotherapy? Then we would be able to work on dosing or mitigation. Instead, the company folded, the research was abandoned and we'll probably never know.
And further, it's a cold calculation but instead of having healthy lives ruined you would have terminally ill patients die slightly sooner.
Ridiculous - The idea of testing drugs with the hope that they magically treat something completely unexpected and without any theoretical framework supporting it.
Inhumane - Terminally ill people could hardly consent en masse to such a program. I suppose there is a utopic idea here, but you might as well wish everyone were healthy forever.
Fundamentally ignorant - The previous comment explained why terminally ill patients with many different medical problems would make poor subjects for a study that ostensibly informs medicine applied to generally healthy people.
"Ridiculous": the whole point of the OP is that we don't have good predictive models for what treatments will be effective. We have hunches and theories but it is currently too costly to go through the whole process to test them all. One approach would be develop better models, but I'm suggesting another approach would be to reduce the cost of testing them in the real target.
"Inhumane": well that's the ethical question. Some countries compell vaccination because of the societal benefit. I'm not even proposing compulsion.
"Fundamentally ignorant": in the end medicine is needed to treat sick people, not healthy people. The OP makes the point that sometimes a biased, representative sample is better than an unbiased, unrepresentative sample.
What if it is a vaccine against cancer (such as the HPV one)?
You think a sane parent would offer their healthy child for a drug trial? You'd need the fucking Nazis to accomplish this (they did, see Mengele et al).
"ethically repulsive but from a consequentialist point of view" or just plain crazy.
Strangely enough, we already test vaccines and other drugs on healthy volunteers.
In my opinion we already know the best predictive model to use, but we choose not to use it. When Jenner developed the first vaccine back around 1800 he didn't use any petri dishes or mathematical models: he just found some nearby children and tested his theory directly.
Now you may find this ethically repulsive but from a consequentialist point of view it was the right thing to do at the time. This line of research saved hundreds of millions of lives.
I say we have gone too far in the other direction. The problem with failed costly clinical trials is not the failure per se but the cost: in money spent, time, reputation, commercial return, legal consequences, etc. And the hidden cost of how long the whole process takes even if successful.
Take the field of monoclonal antibodies. We now have almost off-the-shelf technology to develop drugs that specifically block certain biological mechanisms. But it still takes 10-15 expensive years to progress through different lab and animal models, then healthy humans, before clinical trials on actual patients.
Instead we should reduce the cost of human trials: have a network of terminally ill volunteers to test mabs at an early stage. Fail fast to move fast. Use the money saved to offer defined compensation when things go wrong.
The drugs that we really want to find are the ones with an obvious effect on real patients. This process would find those drugs much faster, and save lives overall.