Variety of reasons, but primarily because of past history of Palestinians causing civil unrest when they’re in other countries (see Black September, Lebanon, Kuwait). There’s also the view that if the civilian population is evacuated then they won’t be allowed back which the Arab states don’t want so they have to stay put.
It’s entirely possible for a large number of civilians to be evacuated…just see Ukraine. It’s yet another peculiarity with Palestine that the preferred options is to force millions of civilians to remain in an active war zone for political reasons.
Hamas also doesn’t want them to leave as then they lose their human shields. Through the warm Israel has been informing the civilians where they’re going to be operating and Hamas have been telling the people to stay put. They use the movement of their own people as a defensive strategy.