BI introduces factionwide checks for traits. So instead of checking each spy just see if an agent has the Has-seen-stone-walls trait exists and if so allow stone walls to be built by building the "invisible" building in all provinces (not exactly invisible since you will have a blank space, which really shows if it's inbetween visible buildings).

The option suggested by apalca works very neat for humans, but the AI does nothing with it so you are probably better off making it more automatic.