Obamacare tried to fix this by making the entire chain of care responsible for patient satisfaction and outcome and making rate payment contingent, but it really ended up consolidating so much of the industry into integrated and profit maximized network-of-relationships so that the downside can be managed (and the backend financing consolidated similarly, though in many different ways). All of them, to your point, really optimized for extraction.
I spent some time looking into generic drugs and compounding operations as well and we really don’t have many left in the West. It’s concerning. No money left for the basics and the system isn’t very robustly built for basic operations (read the boring, lower paying part of medicine that keeps us all alive every day).