Iran taking USD bribe instead of obtaining nukes made it worse for them in long run.
A large segment of the Iranian political class bet their reputations on the nuclear non-proliferation deal with the US in 2015. They've all now been utterly discredited and the hardliners proven correct in all of their predictions.
They can look at Ukraine who bitterly regrets giving up their nuclear weapons, or North Korea, seemingly invulnerable despite being the most pariah of pariah states.
From the perspective of the Iranian state, it would be idiotic and irresponsible not to try to make a nuclear weapon in these conditions.
Things couldn't have been worse for the average Iranian before that, so nothing can really make it worse for them.
I'm not sure I follow your logic, but one could argue this campaign with drones and cheaper missiles taught Iran it doesn't even need a nuclear deterrent anymore.
Between this and Ukraine, the logic of a nuclear warhead deterrent might be considered a paradigm relic from 20th century.