Hey, I am recovering from more minor surgery myself, right now (dental - jaw bone infection). I'm up and posting because my pain meds seem to cause insomnia.
I hope you're feeling a bit better.
Definitely talk to your doctor if your pain levels aren't under control post-surgery, they can help you. But also consider setting aside your weight loss goals for just a bit so that you can focus on healing.
Your body really, truly NEEDS more calories right now. Your body's caloric needs go UP
after surgery -- there is a lot of repair work going on, and if you're at a deficit, your body isn't getting the fuel to do the work it needs. Even eating a maintenance level, instead of a deficit, might not give your body all it requires. Your healing time will slow, and yes, it seems plausible to me that you'd be in more pain for longer than you need to be.
It's incredibly frustrating to have to set aside weight loss, especially when your motivation is high - I am really struggling with this at the moment. It's hard! I want to keep losing. But in the long run, this will pay off. Taking a brief time-out to do everything I can nutritionally to heal is only going to make my body stronger, more able to function well.
Make sure you are getting extra protein these days. Put aside the meal replacement food and try to get as much fresh vegetables and protein as you can.
Here are a couple articles I found about nutrition when you're healing:
Good luck - be well.