I’ve gone through 2 open ing. hernia surgeries (left and right). It took quite a while to recover - for at least 2 months after each I could not think about push-ups, pull-ups or anything straining my abs, but still I kept being active - brisk walking, light dumbbells, muscle isolating machines (ask your doctor).
I completely understand how you feel because I’ve also been there.
I would advise you to do the surgery, put the mesh, stay active and go back to the gym stronger and smarter than ever. Think about it long term - you’ll be set back from the big goal for a while but it’s not the end of the world.
It’s also a good time to think about mobility, pre-hab, stretching and anything else that we skip during a training cycle for lack of time, especially shoulders, knees, back, posture, etc.