Two facts you need: first, clinical trials have very strict rules for who can be in them. Second, some trials are "drug A vs placebo" while others are "Drug A vs Drug B" or "Drug A vs Drugs A and B together" not to mention variations in dose etc. It's not all a matter of "we won't treat half the participants."
I was in a trial for "dose X1 of drug A and dose Y1 of drug B" vs "dose X2 of drug A and dose Y2 of drug B". Previous studies had shown that both of these had the same efficacy, and this study was to compare side effects. There were entrance rules like "no brain metastases" and on each day of treatment, rules about how ill you were allowed to be. I personally came very close to being too ill for the study so I learned quite a lot about that. Your hypothetical patient in very poor condition is more likely to be removed from the study, at which point they can only get the current treatment, not the intervention being studied. (In some cases their doctor can arrange for them to get the study drug outside the study; this depends on how medications are regulated where they live.)
Clinical trials in the US are listed on clinicaltrials.gov. Here is the record for one study I chose at random, studying a possible Covid treatment. You can see that it makes clear what is being compared (this one is drug vs placebo, but explore the site and you'll find drug vs drug, dose vs dose and more), how many are in the study (12 at first, later a total of 40) and the eligibility criteria (quite a way down the page) ruling large sets of people out for being too ill. It doesn't say there that patients will be removed if they develop an exclusion criteria, but that is the practice.
The matter of it being unethical to give someone a placebo is far more complicated than you think, and cannot be solved by giving the sickest people the drug on compassionate grounds. (For example, those people might die at a higher rate than others, making the drug look bad and causing less people to get the drug over the coming years.) Generally, people go into studies knowing they may not be saved by the study and have made peace with that. I can tell you that I did.
As a third fact, in the majority of modern day trials nobody (not the patient, not the people administering the treatment, not the people assessing the subsequent health of the patient -- recovery and side effects) have any idea who is getting what. In my study, there was ONE PERSON I never met who actually put the drug in an IV bag with coded number stickers on it and delivered it to the chemo nurses who administered it. Everything was done the same no matter what arm of the study the patients happen to be in. In placebo studies this includes carefully infusing saline, giving people all the same process as if they were actually getting IV meds. THis would make it impossible for a doctor to do as you suggest even if it was a good idea (which it isn't.)
Studies are sometimes stopped early when those assessing outcomes can see a strong partition into two groups. They ask for permission to "unblind" and if there is a strong and clear difference between drug and placebo, will stop early so as to be able to give the drug to everyone. Here is one example from 2015 for a leukemia study. That article says:
Independent safety monitors oversee blinded trials so that they can be halted or unblinded early in case it is determined that the drug is causing harm or if the benefit becomes clear so that the medicine can be offered to placebo patients. A trial can also be stopped for futility if monitors determine the study is doomed to fail.
This is a rare thing and is not based on some participants being really ill.