The issue here is that if we are drawing analogies, Hamas is more like the Taliban than they are Al-Qaeda. They are the government in Gaza. They control territory, resources, command security forces, receive funds from abroad, run social programs, and administer the local government. Like the Taliban, they offer safe haven to actual terrorist group, like IJP. But they are a government that has embraced terror as an offensive strategy and asymmetric insurgent tactics as a a defensive one.
The differences between them and the Taliban are mainly:
1. They control an urban conglomeration and so instead of melting into hills and mountains they melt into hospitals and apartments to hide.
2. Their adversary does not have the luxury of packing up their shit and flying across the ocean with a promise to come back with B-2s and drones if they get froggy. For Israel, they are the Taliban next door.
Looking beyond patriotic statements for tv consumption, the IDF has articulated clear military and political goals: to degrade Hamas to the point that they are no longer capable of governing Gaza or organizing complex terrorist attacks across the border. Those are legitimate and defined aims even if (see point 1) you can’t accomplish them without a lot of destruction.