Other than destroying the infrastructure as you mentioned, in an evacuation/refugee scenario it’s possible to identify individuals and check them against available intelligence.
Israeli intelligence has had a lot of time to at the very least identify Hamas’s chain of command. While the odd low-level fighter might slip through, any leader would get nabbed before they made it into a refugee camp.