The article isn't really just about cancer drugs, but people care more about cancer than ADHD or diet drugs so it's useful to headline the cancer drugs towards a search for reform.
The actual story is about a long list of drug shortages across a wide variety of categories, driven by a wide variety of proximal causes. That list is here: https://www.accessdata.fda.gov/scripts/drugshortages/default...
I count about 15 drugs which are in shortage or recently were in shortage that are also proprietary and don't have generics available on the market. On one hand you can say "well 15 out of 220 clearly shows generics are more likely to have shortages!" but the vast majority of drugs (counted either by licensed drugs or prescriptions written) are generics. There's not a clear correlation between whether a drug has generics available vs. whether it is or recently was subject to a shortage.
Bacteriostatic water / Water for injection absolutely fits the model you posited -- American Regent discontinued production and no one else wants to fill the gap because as soon as demand is satisfied, prices will plummet and drive negative ROI. Game theory shows the stable equilibrium is continued shortage for these generics, as you've stated. But your model does not fit Wegovy, Semaglutide, Ozempic, Avycaz, Trulicity, Ultravist, etc.
Commodities like medicine and food do have terrible price elasticity which cause great problems in unregulated markets. Unsupported, these commodity prices can crash to floor, and in one year farmers might switch to other crops or shut their doors forever, and then in the next year there would be huge shortages and high prices which take too many years to fix. The original commodity swing could be caused by anything - consumers decide for whatever reason that milk/cheese just isn't that cool this year, last year prices went up 10% and then too many farmers jumped in on that commodity so this year there's a massive oversupply, etc. The natural free-market state of things is: wild price swings and capacity chasing last year's profits/losses. Ideally the futures markets would help stabilize these prices by creating incentive for smart people to predict capacity-demand equilibria for upcoming years and allocate capital appropriately but it doesn't seem to do that effectively for really any inelastic commodity, at least from what I see -- all minerals/oil/gas/food/etc seem to experience incredible price swings on a regular basis. The nature of reality is that demand for inelastic commodities does not seem to be able to be predicted to the precision needed to maintain stable prices and maintain the necessary revenue flows to keep enough producers online in a free market.
That's a major reason why many (most? all?) developed nations create various "Farm Safety Nets" to help create an annual floor for the production of basic food staples. The USDA knows about how much of each basic food staple the nation needs in an average year and works to ensure that something like 110% of this amount is produced each year. They do this by paying for excess production -- in years when consumer demand is low, they pay the excess and leave it up to the farmers to figure out what to do with the product that no one wants. Maybe it's sold at a nominal loss to someone who can use it for something else, maybe it's buried in the ground, whatever. (During parts of the COVID swings, new Farm Safety Nets were authorized because the farmers literally didn't have enough cash to even dispose of some excess food). These basic crops include milk, wheat, oats, barley, corn, grain sorghum, rice, soybeans, sunflower seed, rapeseed, canola, safflower, flaxseed, mustard seed, crambe and sesame seed, dry peas, lentils, chickpeas, etc etc.
There's still the possibility that too many players jump into a market, prices crash, and some producers fail. But the USDA does their damnedest to ensure that 110% (or whatever, I don't know what their target safety margin is) of the necessary production is well supported and can go on to produce again with more guaranteed margins next year.
We probably need more systems like this for some other industries -- medicine being a pretty good contender for the first industry we should put more attention into. It's been working well for our farms and food supplies for 100 years. It has the potential to be used disastrously in a failed communist style USSR/Mao planned-economy debacle or an equally disastrous kleptocractic / regulatory capture / campaign finance corruption / conflict-of-interest debacle, but we've been doing it already for a century and we seem to be doing it reasonably well, all things considered. Though the shortages and price spikes of the past few years since COVID do give me a bit of pause.