A lot of these settlements have either contracters or the IDF directly providing security. So the idea that Hamas could have broken out of Gaza and just found all the soldiers neatly in their bases seems unbelievable. The IDF is an occupying force, not a European military where it's just some dudes with their thumbs up their asses in a barracks near some nature reserve.
Ultimately we can't know how Hamas leadership told their soldiers to behave. But they do have a clear incentives not to condone the killing of civilians: they want to capture hostages and use them as leverage. They need to create the expectation that these hostages are treated fairly and can be returned safely so that it is entirely up to Israel whether it wants those civilians to die.
Tragically, civilians always die in wars. Both sides always propagandise this to claim that it is the other side that is just killing civilians as policy. The facts however, are abundantly clear when it comes to the question of which side shows the greater disregard for civilian casualties.
Everybody is sincere posting about people enjoying stuff. But nobody's talking about how you could possibly feel satisfied after eating a whole bag of candy, instead of feeling like dogshit.
Those small bags of crisps they have in Asia > disgusting Western 300 grams Lays.