it is incorrect to suggest that Netanyahu only cares about staying in office.
Even if you conclude that you can not completely destroy Hamas, there is still merit in further diminishing Hamas by continuing to clobber them, their tunnels, etc for month after month.
That is all the reason Netanyahu and Israel needs to keep going.
At the same time, he wants to stay in office.