I agree that one must be quite illogical and committed to some grander creed to issue a prohibition on nuclear weapons while Israel and USA are doing everything in their very much nuclear power to destroy you.
https://en.wikipedia.org/wiki/Ali_Khamenei%27s_fatwa_against...
It's definitely illogical to enrich materials to nuclear grade and invest immense amounts in bunkers with centrifuges while saying you don't mean to have nuclear weapons.
No, those are both rational actions in this case. Iran getting nukes is less dangerous than only Israels current nukes. If both Iran and Israel had nukes, the region might have a chance at peace.