There is no need for magical thinking, but you do need to take a step back and look at the bigger picture.
Many countries view it as a much simpler problem of optimizing their society as a whole:
1. There are N doctors & medical supplies.
2. There are M people that have an illness.
3. How can we as a society make sure that these M people don't die?
Then, you (as a society) make up a set of rules and incentives and economic structures so that longterm you are able provide treatment to M people and define what "adequate" means based on your resources. If someone wants more than "adequate" treatment, you add some way to pay for things. Ideally in wealthy countries these are never actual medical necessities.
Once you're there, you just solved 80% of the problem and nobody dies just because they weren't rich.
Of course life is messy, so you need to have some resources to spare for edge cases and exceptions to the rules out of compassion, where there are e.g. experimental treatments, etc. It is true that there will be limits as to what you can provide, as treatments will cost money and disability-adjusted life years gained will go towards zero the older you are.
But that is also the case when you have a "pay money, get service" system, even if you are extremely rich you will not be able to extend your life forever.
The rationing happens either way, and in most countries you would need to be extremely rich to be able to come out on top. Actually you would need to already be born rich in order to be able to pay for anything that comes up in your childhood. That is extremely cruel, but unfortunately a reality in some places in the world.