That is neither what the laws of war say, nor what the Israeli argument is (or at least, it's a misrepresentation).
The laws of war say that if a medical facility (or any other civilian infrastructure) is used by militants as part of the war effort, then it loses its protected status. Israel's argument, whether you agree or not, is that this occurred, thereby making those targets legal.