@E. Richard
You are probably right, but my idea was to try a more general script, not only for a given faction, if it is possible, of course.
In fact, the ancillary could be restricted to some factions using the ExcludeCultures command, which is often used in export_descr_ancillaries.
In any case, I will try a background script with your idea just to test this syntax.

@Dromikaites
In the meantime, I will try your idea. As I know that Burubista is the spy I'm using, I will work with this just to see if the script is correct.

@ Both of you
I was wondering if we could play a little bit with the faction_capability.
Would there be any type of capability that we can put as requirement for the first, invisible, building? Could we give this capability to a faction through scripting?
The problem with the ancillary is that it is given only to the spy. That means that if it is killed in the next turn, the faction losts the ancillary. The capability would be permanent, irrespective of the characters alive in each moment of the campaign.

Another point is if there is some "general way" to detect the settlements owned by a given faction and to build a building in all of them.
I didn't find anything like this (all the commands of creation of buildings require the name of the settlement), so the script should contain a check for every settlement in the map.