Hamas did not invade Israel. What are you talking about? They didn't try to take over territory. They committed an act of terrorism, not an act of war.
A missile strike is a legitimate casus belli. If you're not a pacifist, that means it justifies force to achieve a military objective, which necessarily justifies killing civilians.
Whether that's "countless" or a few depends on the objective.
In general, civilian-combatant casualty ratios range from 1:1 to 5:1. They tend to be higher in urban settings like Gaza. The Chechen wars were closer to 7-10:1
The US estimates 15,000 combatants have been killed in Gaza. If so, we would consider 15,000 to 75,000 civilian deaths to be normal at this point.