On the other hand, the whole point of constructing humanitarian law to be independent of the moral claims surrounding the war itself is that while there is at least one wrong side in every war, there is no real hope of getting the warring parties to agree on which side that is, so the only way for humanitarian law to make them behave any better is by side-stepping the whole issue of who's right and who's wrong.
This is a little too strong for me. In domestic criminal law some means are permissible for resolving personal disputes and others are not. If you insult me I can insult you back but it is illegal for me to kill you in response. But in cases of actual self-defense I can kill you. There are even cases of less immediate self- defense in which this is permitted (some types of extreme stalking, abusive spouses, etc.). Other provocations don't justify murder but they can lead to more lenient sentences. So it doesn't seem to be the case that law needs to ignore context. The fact that neither of two warring nations would admit to being in the wrong is beside the point- just as contextual facts are evaluated by domestic courts they can be evaluated by international courts. And the extent to which a particular set of circumstances can alter the ruling is a question of jurisprudence, a jurisprudence that can't be established until we have an impartial and legitimate international justice system. A court needs to evaluate some test cases to establish the kind of exceptions we want. Unfortunately, I'm not sure we actually have a legitimate and impartial international court.
Even if we had a perfect court, we have no enforcement system. If we had a working enforcement system, we could use it to prevent all the wars in the first place.
International humanitarian law proscribes certain actions in war, particularly actions that harm non-combatants. On a strict reading of these laws (see what Richard Goldstone said in his debate with Dore Gold at Brandeis University here and see what Matthew Yglesias had to say here), these actions are prohibited regardless of the justice of the war itself: there are certain things that you are just not allowed to do, no matter what. The natural response of any warring party accused of violating humanitarian law and confronted with this argument (aside from simply denying having done the things they are accused of doing) is to insist that their actions in the war cannot be judged outside the context that led to them going to war in the first place. They are the aggrieved party, they are in the right, and they did what they needed to do to defend themselves. Any law or law enforcer who fails to understand this critical distinction between the good guys and the bad guys is at best hopelessly naive and at worst actively evil.
What to make of this response? On the one hand, the position taken by Goldstone and Yglesias can't strictly be morally right. No one really believes that moral obligations in a war are completely independent of whatever caused the war in the first place. For example, it can't but be the case that the set of morally acceptable actions if you are defending yourself against annihilation is different from the set of morally acceptable actions if you (justifiably) take offensive action in response to some relatively minor provocation. (Which situations justify which actions is, of course, a hugely important question, but it is not the point here.) On the other hand, the whole point of constructing humanitarian law to be independent of the moral claims surrounding the war itself is that while there is at least one wrong side in every war, there is no real hope of getting the warring parties to agree on which side that is, so the only way for humanitarian law to make them behave any better is by side-stepping the whole issue of who's right and who's wrong.
So any sensible moral standard demands that the context be considered, but there is an excellent reason why the legal standard requires that it not be. What to do? Since requiring that the context be considered would pretty much be the end of humanitarian law, the question boils down to whether the benefits of a neutrally-administered humanitarian law are worth whatever injustice would be suffered by the occasional country that gets condemned for doing an illegal but morally justified act. I think it's clear that these benefits far outweigh the costs, but in any case that's the tradeoff.
P.S. Though I used Goldstone as the example to motivate the post, I deliberately stayed away from discussing the specific war that he was talking about. I don't think my views on that war can be inferred from what I wrote in the post, but in any case I would ask that folks not argue about them in the comments, not because it's not important, but because this isn't the right forum for it.