Hamas freed three Israelis and five Thai hostages but Israel decried “shocking” scenes at the site of the handover as fighters swarmed the hostages.