The recently rescued hostages were kept in civilian homes.
This is an urban conflict zone, so the combat zones and zones directly adjacent will all have evacuated civilian homes within them. IDF and Hamas are using civilian homes in these areas as outposts, places for combatants to shelter, places to mount attacks and secure perimeters. Keeping the hostages in vacated civilian homes outside any declared safe zone is not a violation of the rules of war. Especially since, unlike Israel, Hamas cannot remove any POWs or hostages from the Gaza Strip.
The rescued hostages were not held in the then IDF declared civilian evacuation safe zone (Al-Malawsi) or an internationally recognised safe zone like a UN or IRCS building/school, hospital/medical facility or a place of worship.
In addition, the Geneva Convention requires that all parties remove POWs or civilian captives(hostages) from active combat areas and keep them from harm as much as possible from ongoing combat operations. This means keeping them behind front lines or away from active combat zones while not imprisoning them within any declared evacuation or safe zone for civilians.
The use of a vacated civilian home in a conflict zone is not a get out of jail free card to dismiss 270 dead civilians and 3 dead hostages to rescue 4 other hostages. Whether this was a disporportionate death toll for the mission and a war crime by Israel will most likely be decided by the ICC and ICJ in due course.