I don't care if governments think getting a nuclear weapon will keep them from getting attacked. Of course they think getting a nuclear weapon will keep them from getting attacked. Because getting a nuclear weapon will keep them from getting attacked - at least until global nuclear annihilation happens and they die with the rest of us.
It's not a question of whether or not governments want nuclear weapons. Every government wants a nuclear weapon. The whole point of the NPT is to prevent them from getting what they already want.
And not enforcing the NPT, is a sure as shit way to guarantee that countries begin to ignore the NPT.
If the goal is to prevent nuclear proliferation, letting Iran get nukes is the opposite of that.