I think its a matter of perspective tbh, i don't think anyone sits there and goes " do you know what, this feels good, i'll carry on" so much as when you are in pain that is actually debilitating the appropriate treatment for that is pain relief, many of which can cause dependency.
This can be either, or both, that you are unable to stop taking the pain relief due to pain levels being so severe without it you cannot reasonably stop, or as others have pointed out, you are physically 'addicted' - aka your body has slowly adjusted to the drug and reacts very poorly if it is suddenly withdrawn, and so you 'need' to take the drug to restore normality.
It is also the case for many other drugs such as antidepressants, or bowel motility drugs, or even thyroid medications, but people don't seem to view people taking those quite so negatively and make assumptions about how there was an element of choice to that dependency, or that they continued a medication for a 'high' and fancied a repeat, which really, is pretty offensive to those who live with chronic and unbearable pain relative so someone who took a short course as a one off and got better.
Lower level things like codeine/co-codamol are problematic because they only take 3 days to create a dependency and are available OTC. GP's dish them out as a first port of call because they kill pain effectively in most cases and are cheap as chips, but long term use of them for pain conditions actually not only makes pain worse, but also creates a dependency which is hard to withdraw from- terrible headaches, seizures, worsening of pain, unpleasant physical sensations etc.
I currently only take one form of pain relief for a serious chronic pain condition but have taken most things, for varying amounts of time. I have never had to 'ask' a GP for anything past the point of stating I am in severe pain, them seeing why ( serious medical condition) and they will give a long term prescription, as is correct.
Chronic pain is very different to acute pain, with acute pain most doctors wouldnt give you more than a weeks worth before you would need to go back in and discuss it, but in reality i find they do just dish out whatever gets rid of you, especially as waits for further investigations for pain are so long. I assume it is easy enough to pretend you are in pain and ask for some and get them, anyone who does that- more fool them, but pain is basically invisible isn't it, unless the GP can easily see the reason and gauge what is needed and for how long- so it is guesswork if the alleged pain has no obvious cause. It is also very easy to just visit several pharmacies and buy OTC tablets in each if you were inclined, say you lost prescriptions, say you need extra for a holiday, there is a great deal of theft from store cupboards in medical settings even with rigorous checkings. I've returned months worth of codeine etc to pharmacies before where GP's have just stuck it on repeat but i either do not need it or am not taking it anymore and the repeat prescription is never checked by them. It would be so easy to stockpile and sell ( obviously would not in a million years ever do this).
There is a real stigma about prescription pain dependency as though people who take it long term are drug addicts or lesser intellectuals for doing so which i find very sad. As someone who has on/off taken several and now needs one to function, literally, i can add into the conversation that the side effects are appalling, i have never in my life enjoyed a 'high' from anything i have ever taken- mostly it results in vomiting/dizziness/fatigue/constipation/headaches etc- nothing desirable about it long term.