I'm not following the logic. Lebanon is much larger yet Hezbollah also embeds rocket launchers in with civilian infrastructure. Ukraine is vast yet cities are getting bombed all the time and are used as cover. Would you suggest to Ukraine that they should refrain from attacking Russian soldiers when they're in a city?
Is your theory that if the Hamas had more land on which to place rockets they fire at Israeli civilians then they would take more care to place them ("operate out of") away from civilians?
To answer your question, they're not supposed to "operate out of" anywhere in the first place.
Israeli civilians and cities are under more or less constant attack or threat of attack.
Where exactly are they supposed to operate out of?
And it turns out it’s quite easy to not bomb civilians. You don’t drop bombs in cities.