Complex multiparticipant systems don't
have goals, other than to perpetuate their own existence. The health care system isn't conscious. It's the collective interaction between a number of constituent organizations: health insurers, private hospitals, doctors, taxpayers, government, patients, employers, etc. Some of them may have individual executives making decisions over
part of the system, but if those executives' personal goals are significantly misaligned from "transferring money from the population to their organization" then the organization that pays them would've long since gone under. Hence the observed behavior.
Similar evolutionary dynamics can be observed in all complex systems - life, biomes, religions, community, government, law, capitalism, tech companies, etc. Any system that does not optimize for its own survival will be replaced by systems that do. And the way to align that with the continued benefit of the humans that the system was supposed to benefit is to make systems "default dead", and then hinge their continued existence on them providing the benefit that they were created for. Unfortunately this is easier said than done, because another human evolutionary impulse is the drive to create systems that will continue to exist and benefit the person who created them (though not necessarily stated collaborators) without any additional effort.