I had a similar experience, albeit (and thankfully so) much more short term. I had spine surgery (lumbar laminotomy[0]) to address spinal stenosis[1] that significantly weakened my right leg and was prescribed oxycodone after the surgery.
I had prepared for this by acquiring significant amounts of cannabis (concentrate, butter and flower) to address the pain, but for four or five days, cannabis was insufficient to address the pain.
After the first two days I reduced the dosage and frequency of taking the oxycodone as I was concerned about dependency.
I will say that the first two days (full doses at four hour intervals) made me understand why some folks end up dependent on opioids.
My takeaway was that short-term use for acute (vs. chronic) pain, opioids are very effective.
For lesser pain levels, cannabis is also useful, with the caveat that cannabis doesn't actually get rid of the pain, you just don't care.
Your experience (and mine as well as that of many others) make it quite clear that (at least in the US -- elsewhere too, but legal regimes are different elsewhere and I'm not necessarily familiar with those) cannabis should be removed from schedule I (and potentially moved to schedule IV or removed completely) of the Controlled Substances Act[2], which would allow more widespread research into pain management and other medical uses.
I hope you don't find yourself in that situation again.
[0] https://adrspine.com/treatments/lumbar-laminotomy