Why is it rational to blame all the Arabs in Gaza for Hamas terrorism?
Not all, but some critical mass of people in Gaza enabled it. Thousands more perpetrated it. If they weren't run by a deranged terrorist organization for the last 18 years (a whole generation), Gaza could have built its own electrical, water, and other infrastructure instead of using those resources to build rockets aimed at Israeli towns.
Sadly many of those apartment homes were being used by terrorists. Terrorists that chose to use their fellow Gazans as meat shields and Gazans that were foolish enough to let them. Or at the very least foolish enough to choose to live in proximity. If Israel is sure a building is being used by Hamas, it's no surprise they want to destroy it. This is exactly what Hamas wanted by the way, to put Israel into the dilemma they find themselves in, at the cost of the lives and property their fellow Gazans.
RE: An Analogy