In some countries, there are plans to "regulate", in this case to mandate distributors to keep 4 months of supply. I doubt if that will work.
Instead, like the UK NHS, where the healthcare itself is non-commercial and fair to everyone, the R&D + production of drugs could also be organized much better:
Do the R&D via universities, that should receive grants to develop into directions that are socially wanted, instead of developing more of the same (like high-bloodpressure drugs) just because of commercial interests.
States can collaborate and organize e.g. very expensive high engergy physics R&D (such as CERN) or fusion energy. Why would the same system not work for drugs R&D?
The production itself, completely patent free, can be granted according to demand to commercial companies. These just produce what health care systems order. The states/systems pay a fair price allowing the companies to have a decent profit margin to remain viable, but the current profit margins in the pharma sector are much too high and immoral, since there are people dying because they cannot affort the necessary drugs.
I think this sector has proven more than once, that it is not capable of taking the very high responsbility, but is driven by greed that leads to immoral actions.