What kind of surgery is the doctor talking about that will prevent you from ever lifting weights again? If you can, I'd track down a surgeon with a history of working with athletes and get a consult.
First of all, plenty of guys have hernia repair surgery (like mesh implant) and eventually return to training.
^ 6 big threads over the last 6 years about people training after hernia repair, but yours will have you out of the gym forever? Unlikely, at best.
Secondly, you don't have to lift heavy to train legs effectively. Plenty of routines use moderate volume and "less than heavy" weights to build muscle. Intensity-boosting techniques (drop sets, slower tempos, exaggerated peak contractions, etc.) can also make "light weights" feel heavy.
Thirdly, techniques like strategic breathing to minimize intra-abdominal pressure (like not holding breath/valsalva'ing, or intentionally breathing out on the concentric) can help minimize stress at the hernia site.
Long story short, if that's literally the only quad exercise you can do, then that's that and it's (technically) better than nothing. But, even without knowing more detail about your injury, I'm pretty sure that's not really the only option.