It was a treaty, many concessions existed to ensure both parties were comfortable with the arrangement. But that does not at all suggest that the agreement didnt account for foul play on either side.
It was an incredibly solid diplomatic option employed for several years, during which the perpetual "months away from nuclear weapons" rhetoric never proved well-founded. Iran's existance is perpetually an existential threat when the only alternative to diplomacy is its total destruction at the expense of American and Iranian lives.