Such close-quarters spying efforts are expected but nothing extraordinary in comparison to what Syria, Iraq and Iran experienced in terms of sabotaging efforts.
Based on records becoming public, CIA, MI-6 and GISS knew a great deal about nuclear-related developments in Pakistan, and one of the European colleagues of Dr. Qadeer Khan also spilled the beans some years back when Pakistani nuclear proliferation reports surfaced. In fact, Ronald Reagan openly supported Pakistan's nuclear program, his hatred for India notwithstanding. Then in the 1980s, US and Pakistan became very close to thwart Soviet efforts to subjugate Afghanistan (Operation Cyclone), and it was during this period that Pakistan had developed the bomb but tests were carried out in 1998 in response to Indian.
Iran have a long history of busting many spies over the course of years. Consider this incident:
https://abcnews.go.com/Blotter/cia-spies-caught-fear-execution-middle-east/story?id=14994428
Still, did not stop NSA-CIA-MOSSAD nexus from ruining the centrifuges of heavily guarded and isolated Natanz facility in 2014:
https://www.wired.com/2014/11/countdown-to-zero-day-stuxnet/
We should be humble in our judgement and thank Allah Almighty for making this possible - he creates 'wasilley'.
The most impressive march towards becoming a nuclear power is that of DPRK. How it pulled it off in spite of being heavy sanctions and lack of access to European nuclear markets of the 1960s - 1970s - just wow.
China also deserve credit for helping Pakistan achieve its nuclear ambitions - lot of it.