There are no rules of war governing this situation.
For rules to govern something you need a government to enforce those rules, and this of course doesn’t exist.
That’s precisely the problem.
Oh sure, in theory, there are various treaties, some of which the UN has said apply whether you sign on to them or not. But that doesn’t mean these rules govern this situation, because again, there is no government to enforce the rules, and thus, no governing.
For example, by these UN rules, Iran certainly shouldn’t be attacking Israeli civilians through their proxies Hamas or Hezbollah, nor should they disrupt international shipping through their other proxies the Houthis, nor should they use the Houthis to create a devestating decade long civil war that results in famine across Yemen.
So what? What is going to be done about Iran doing any of those things? Precisely nothing.
What does govern international relations is the actions of various polities. Iran isn’t going to stop doing the things I listed above because they are “against the law”; America and much of the world have tried to use economic pressure for decades, to no avail. So now they are being stopped by force.
Yes, you are correct - of course. But the key point is that those states are actively working to make the world closer to their personal vision. What stops them is vigorous opposition from other states, not international law.
“America shouldn’t take actions to make the world more liberal because this would legitimize other actors, like authoritarian Russia or Islamist Iran, taking actions to make the world more authoritarian or Islamist” is a bad argument because Iran and Russia are already acting this way. We should vigorously oppose them, not bury our head in the sand to avoid offending them.