Or in the places where a mostly capitalistic system provides it. I did something similar last year in India and the medical system was not a problem. (I did not by any stretch of the imagination get lucky and manage to avoid injury.)
True, the capitalistic health care system in India is good for software engineers, who probably fall into the class who can afford it, but it's far from available to every citizen.
Also, the high-tech healthcare that we are accustomed to in the US is generally only available to the upper classes in India or people who pay with foreign (>local) purchasing power. Some of the hospitals that provide high-tech care do some symbolic pro-bono care for the poor, financed in part by donations from Indians abroad and foreign medical tourists. (Source: my parents have donated to such hospitals, and I have some acquaintances who have gone to India to have cheaper-than-US specialty medical procedures performed).
True, lots things in India are not available to everyone. E.g., running water, enough food, etc. This means India is poor.
To make the best comparison I can think of, spine surgery cost me 0.5-3 months of a local software engineer's salary. In the US the billing error might be 0.3-2 years of an American engineer's salary.
Yes, a similarly high cost difference is what drove my acquaintance to have orthopedic surgery in India, which was far cheaper, even when including the cost of several weeks of recovery at a resort in Kerala. The US has uniquely high costs for specialty medical procedures and devices.
A friend who runs a biotech startup told me that most European companies developing medical devices and pharmaceuticals justify the high R&D costs and regulatory risks by targeting the high profit potential of the US market. In most non-US developed countries, they aren't allowed sell their product for as high a cost by law.