It's cheaper to build low precision rockets/drones than the Israeli interceptors, so the war _could_ swing in Iran's favor in the long term.
Additionally, Iranians aren't rising up because they don't want to be seen as being controlled by foreigners, but once the war stops, the Iranian regime will have to answer to its citizens. This means the mullahs have no incentive to stop.
In the opposite direction but with the same outcome, the just-barely-enough aid that Ukraine has received after being invaded by Russia, has demonstrated that it's foolish for countries to give up their own nuclear weapons, on the understanding that a friendly superpower will protect them.
This has been a very bad decade of events for incentivizing nuclear non-proliferation. I hate it!
Imagine that Iran already had 10 nuclear bombs and the US bombed the production sites with B2s. What would Iran do? They can't drop a nuke on the US, and even if they could, that would just ensure their destruction.
Of course, one could argue that Iran is not rational and that it would nuke NYC even if it meant being destroyed as a country. But if we're assuming that they are irrational, then that's all the more reason to get rid of their weapons, even if it meant taking casualties.
And note that the same calculation applies with Iran vs. Israel. If Israel attacks Iran conventionally, Iran cannot escalate to nuclear without also getting destroyed (since Israel has a larger arsenal).
Moreover, Putin's invasion of Ukraine, actually demonstrates the uselessness of nuclear weapons. Yes, NATO and the US were initially deterred because of fears of Russian escalation, but we've continued to cross "red-lines" in arming Ukraine without escalation (tanks, F16, missile attacks on Russian soil, etc.). I'm pretty confident that Europe at least will continue to support Ukraine with ever more powerful weapons without fear of Russia's nuclear threats.
In your hypothetical, we're sending B2s to drop bombs on their production sites. In the reality, we would not do that, for the same reasons that we are not sending B2s to drop bombs on North Korea's production sites.
Ukraine didn't have nukes. Would they have been invaded if they had nukes? Unclear. Maybe. Maybe not.
Taiwan doesn't have nukes. China wants to control Taiwan so, so bad. But, they're staying at a distance for now. Why? Taiwan is an extremely valuable economic ally of the rest of the world. No one wants to disrupt the status quo. We're too interconnected.
Iraq was reported to have nukes back in the 00s, and this was a reason why the US invaded them. We now know, they never had nukes. Maybe there were leaders in the US who knew this at the time, and just outright lied. But, if not: nukes did not protect them from being rubbleized by the US military industrial complex.
Poland doesn't have nukes. Russia isn't going to touch them, despite bordering deep Russian ally Belarus. What makes them so different from Ukraine? NATO. Political alliances. Ukraine didn't make political alliances. No one gave any thought to Ukraine before and even after Crimea; they were always just a weirdly dysfunctional and corrupt ex-Soviet country that no one cared about. Poland is different; they played ball with the west.
North Korea does have nukes, but they don't really have any significant or interesting way of using them. They could hit SK and Japan, but that's about it. We leave them alone. Why? Well, maybe nukes. But moreso: they're chill. They don't have external ambition. They can barely take care of themselves. They aren't calling for the rubblezation of their enemies anymore. Its not the nukes that keep them safe; its the reality that they're kinda playing ball with the rest of the world, in their own way.
Nukes probably help, but the far more likely guarantor of sovereignty is to be valuable to the rest of the world. Have a democratic government. Communicate. Trade. Address corruption. The main thing that Ukraine, Iran, North Korea, 1950s Vietnam, Syria, Libya, etc all have in common is that they're all backward, isolationist countries that never wanted to join up on the global stage, for either side. NK is the only one that's really managed to stay that way mostly unscathed.
The incentives for having a nuclear program have not changed. Ukraine did not have nukes. Crimea, as a part of Ukraine. Syria. Iraq. Afghanistan. Vietnam. Libya. None of these countries had nukes. They paid for it.
What happened today isn't only not a "massive" change to the status quo, as you seem to think it is. Its so much less significant than what happened to the rest of those countries I just listed. Yet, you used the word "massive". Why? I have no idea.
Iran did not learn any new lessons yesterday. Nothing they didn't already know. The US does not want them to have nukes. We've done everything short of boots on the ground to stop them from having them. They should still want them. They're correct, in the defense of their territorial sovereignty, to want them. But, we'll keep stopping them. That's how it was in the 2000s, the 2010s, its how it is the 2020s, and it's how it will be in the 2030s and 2040s. They keep trying, we keep stopping them. The incentives haven't changed. Nothing has changed. Yet you doomers keep thinking this is the end of the world or its WW3. It isn't.
If anything has changed: Iran just learned that something which took them a decade of development, cost hundreds of lives, and billions of dollars, was stopped by a couple planes from a country half a world away at basically no cost to us, without barely a thought or care. Fox News was tracking these B2s on ADSB a day before they hit Iran; it didn't matter. That's how ahead the US is. The asymmetry here should scare the shit out of them, and the world; that they will never have a conventional nuclear program because they're so unbelievably outmatched and outgunned that if our President has one bad nights sleep he could just wipe out half their country, half of any country, with no congressional authorization, no checks, no balances, just launch a plane and they're dead. Maybe this pushes them to non-conventional means of obtaining nukes; but it shouldn't significantly change their desire for wanting one in the first place. They've always wanted nukes.
I don't think you're disagreeing with me, you're just comparing to a more recent status quo.
Nuclear non-proliferation was based on the idea that small countries didn't need their own nuclear weapons, because they could ally with a superpower / bloc with nuclear weapons, and piggy-back on those superpowers not wanting to go to war, to avoid nuclear confrontation.
It is true that some countries, like Israel and North Korea, never bought that idea, and went ahead and got their own nukes.
That those countries who didn't buy into non-proliferation have fared better in the last couple decades than the ones on your list who have been attacked with little repercussion, is exactly the point.
Ukraine was willing to give up its nukes decades ago, now it's clear they shouldn't have. Iran was willing to enter into a non-proliferation agreement a decade ago, now it's clear they shouldn't.
But this is a much worse equilibrium than if we could have actually made non-proliferation work. Now every small country should clearly be trying to build nuclear weapons, if they can. And I think that's bad.