I don't get what is so complicated for the IDF to defeat Hamas and their tunnels. They have to discover all the entrances and simply seal those. If in the end they wanna surrender I think they can dig their way out with explosives..
The only problem would be if pretty much all the population in Gaza identifies as being Hamas. Then you should not destroy civilians.
However from videos I've seen when IDF hits a bunker, black smoke comes out of the entrances rather vertically so you can make an image where those tunnels lead.
Azovstal was nastier as that bunker was deep and not horizontal like in Gaza's case