How should this system work, in an ideal world?
This is an extremely politicized question in the US, where a public health insurance option (a solution that's popular in much of the rest of the OECD) is fiercely opposed by a large swath of the population.
At the very least though, in an ideal world, payers, providers, pharmacies, and PBMs should not be allowed to be part of the same company.
And yes, get rid of PBMs. They are toxic middlemen who want their 'cut' for doing nothing at all.
See Gale (2023): https://pmc.ncbi.nlm.nih.gov/articles/PMC10441264/