The secret of international law is that it only works one way. When its applied to the strong against the weak its applied as restrictively as possible. Every attack is a war crime. Every bombing a violation. The only permissible tactic is to line up your ground troops like lemmings and have them gunned down.
When its applied to the weak against the strong everything is permissible. Its ok if Hamas or Hezbollah bomb cities. They dont have the technology to do better. Iran attacking neutral Gulf States is just great strategy instead of the crime of aggression.
This is why there is no incentive for the strong to follow international law and as a consequence the weak are not protected by it.
Theres actually one piece of international law that mostly works. UNCLOS. Thats because its treats both strong and weak nations the same and gives them the same baseline to claim sea areas. This is useful to nations because they need that stability for oil companies to engage in long term projects. A law that is useful and reasonable is actually followed.