I often demonize pharma because my partner works in that field. People in that field are often blind to its faults, like perverse incentive structures and Byzantine regulatory processes that often harm more than help. Pharma companies' R&D budget is dwarfed by its marketing and expenditures on financial games like stock buybacks, so this talk of recouping costs doesn't hold much water in my opinion.
If something is necessary but unprofitable in the near term, the early research is often already publically funded, like the mRNA vaccines.
The 17yr patent clock ends up leaving a handful of years for a company to balance its books before expiry and the onslaught of generics.
Hence the ludicrous per-pill costs.
Those demonizing pharma have not done the homework.
Disclaimer: wife works in pharma.