I'm afraid I have no idea. In my case it's just based upon experience rather than a scientific study that makes me feel that it is less likely. The deal does improve the AI attitude towards you though.ROPs do improve AI attitude as well but I never use them anymore. I might yet play a game where I need to sign one but I honestly can't remember the last time I used one. Also note that the Zulu have the highest aggression rating. In my games, I never totally let my guard down on the Zulu, Aztecs and Germans to name but three. I certainly wouldn't give them an invitation to roam my lands, probing for any weak points with my blessing.
Just because the AI is polite doesn't mean that they won't attack. I'm glad that there is a certain amount of unpredictability in the game. A human player could be on good terms with an AI, trading resources, maybe an ally in a war but all the while could have designs on taking the AIs land to stop having to pay for those resources, etc. The closer the AI mimics behaviour like that, the better the game is IMO. I don't know how sophisticated the algorithm is that triggers an AI attack but it surely takes into account what there is to gain, what there is to lose and how strong you are. Maybe as you had no strong attacking units, you looked like a juicy target, ripe for the taking.
I'm not saying that it isn't annoying when it happens sometimes and I'm not saying that I don't take risks. I just try to spot the warning signs and have a plan B whenever possible. In your case were you able to hook the iron up very quickly? Maybe you also had horses in which case you could have built a few of those to help disuade an attack or at least deal with it until the swords were up and running.
BTW sometimes there is a very good reason for an AI attack but you just don't see it for a few thousand years. In one of my first attempts at Sid, I played a 'pelago map (to give me some time to expand) and I managed to get a smallish island to myself. I traded heavily, and even gifted techs to a couple of civs when entering the new ages, and my relations with AI civs were all very good. This did not stop the swine trying to sneak attack me though, even though I had selected some of the less aggressive civs as part of the set of rivals. By the IA I had been declared upon by all of the civs (not all at the same time though; I used alliances to avoid getting dogpiled) and yet the landings were all in the same area. I had no resources there at the time so I knew that something good was going to pop up at some point. It later turned out that I had two of the three sources of Uranium on my island.