With targeted operations like this, they knew exactly who they were going after and where. That’s not a defense of Israel’s actions, just a statement that this isn’t the sort of thing they’d do to take out some random civilians.
In fact, much the opposite. This more closely resembles the sort of action Israel could have done from the beginning to take down Hamas without destroying Gaza. It would have deprived Hamas of their propaganda wins, would have kept the world firmly on Israel’s side, and would have been much more effective long-term.