My daughter has bad arthritis and is allowed to be on pain medications for the pain. They cause constipation, she's feels pretty foggy and out of it, but no other issues. We give her Miralax for the constipation.
She was also allowed pain meds when she got her wisdom teeth out. She was not given antibiotics for those, as far as I can remember (I could be wrong though!). She also recently had a GJ tube placed and was given IV pain meds and then oral pain meds without any issues.
She was taken off MTX/Humira for her wisdom teeth surgery but for her G tube placement was not told to get off anything.
I can't remember what your son is on but I'm guessing he's the one who is doing well on diet? So hopefully no med issues.
Overall we've had LOTS of experience with pain meds and no real issues. When she's been admitted for GI issues, they give her Nubain, which is an IV opioid that has fewer gut side effects. It's not as strong as Oxycodone/Vicodin/Morphine, as far as I know, so they may not want to give that for a surgery.
I hope the surgery goes well - good luck!