A pet peeve of mine since you mentioned codeine, that neatly shows just how fucked up government regulation in this area can be:
There's good evidence that restrictions on quantity of acetaminophen/paracetamol sold in a single transaction reduces overdose deaths. E.g. in the UK it is estimated that restrictions to 16 (in regular shops) or 32 tablets per sale (in pharmacies) has saved 600+ lives since 1998. There are still 100+ deaths a year from it, though.
Yet the sale of pure codeine is substantially more heavily regulated than the sale of co-codamol and other variations of paracetamol/acetaminophen or ibuprofen mixed with codeine at ratios that means that anyone with a serious codeine addiction finding themselves unable to get a prescription or find a dealer for pure codeine might find the mixed products available over the counter as their only source at times. Yet chances are they will have to take a potentially dangerous dose of other painkillers to get their codeine high.
So, we have evidence that people often intentionally or accidentally die of acetaminophen/paracetamol as well as ibuprofen overdoses. Yet we consider it acceptable to require codeine to be mixed with these (and other) drugs for over the counter sales.
Codeine alone is one of the safest opiates we know, with a substantial safety margin for use, but also highly addictive, and so chances are a subset of users will get sufficiently addicted to be unable to properly control their usage, even in the face of taking substantial risks.
In other words: Fuck off and die a painful death if you get addicted enough to fail to manage to resist (or pay attention to) taking too much of the other drugs it's mixed with. Oh, and when you die, remember it's because we intentionally ensured you had a supply that was effectively mixed with poison.
That codeine addiction is often the result of its extensive use as a prescription painkiller and in hospitals exactly because it is so safe on its own just makes the whole thing more offensive.