This is what is done in patient outcome rankings for exotic therapies and surgeries that are a skill-based premium or are exceptionally expensive.
My perspective is, most small molecule therapeutics are already prioritized for production and trials based on synthesizability. So if some corporation really did find a viable treatment for COVID, I doubt scarcity would be the issue unless it fundamentally fails some medicinal chemistry principles for ease-of-synthesis. This is given how primed the global supply chain is to pump out a real treatment. Think of these checks as "code smell" checks, except in the early stages of drug development. Lead optimization is essentially the entire field of optimizing for desired properties, which is what would most likely be done to an extent if a molecule was prohibitively difficult to synthesize.
Btw, there's actually a LaunchHN on the frontpage that's right in the middle of tackling this kind of problem.
The great argument I wanted to make is that if there is a finite supply of a drug, only enough for 20% of the sick, selecting which 20% gets it doesn't cause more people to die. It might select who dies in deplorable or admirable ways, but the death count is the same.
But you're making a different and better argument.
I agree that your scenario would be terrible. But I don't think it describes what Gilead is doing. According to posts here, they're allowing generic manufacturing in poor countries, and India doesn't even respect drug patents to begin with.