Mr. Gallant had differed with Prime Minister Benjamin Netanyahu several times over Israel’s conduct of the war in Gaza.