The logic is simple really:
They could have built a bomb but didn't, before being sneak attacked under cover of diplomacy by the Axis of Epstein.
Now, since they were attacked twice during "negotiations", they see clearly that the US and Israel (really they are one, with Israel governing the US), are bad faith actors who don't honor their word and the only way to ensure that another cowardly attack doesn't happen is to build a nuclear weapon.
Let's not forget that there was a nuclear agreement between Iran and the US that ensured that Iran would not build a nuclear weapon. Regular inspections confirmed that they were not building a nuclear weapon. After Trump ripped up the agreement in 2017, there was no law or rule saying they should not enrich uranium.