No that is not the point. If the IDF is willing to shoot knowing civilians are in harms way, it is still a crime, UNLESS the people doing the shooting are in a life and death struggle. If they can choose to not shoot without facing imminent danger then they should not do so.
I agree other than the word "imminent".
IDF is entitled to use lethal force to put a stop to rocket attacks on Israeli territory. See article 51 of the UN Charter, for example. They do not have to wait until a few second before the rocket is fired to shoot, they can hunt down and kill the people who are shooting the rockets over a period of weeks or months.
They can also attack the command and control structures of the group authorizing and supporting the rocket attacks, and any other military target associated with that group. In short, so long as Hamas is attacking Israel, Israel is entitled to counter-attack Hamas.
In doing so IDF must try to keep civilian casualties to a minimum, but there is no requirement that they must be kept to zero.
The question is more one of intent than counting numbers: Did you fire that missile only because you were trying to destroy a military installation? Or did you pick that target specifically because you knew there would be a lot of associated civilian casualties? The latter is a crime, the former is not, even if in the former case there are a lot of civilian casualties.