I am using Yanfly Event Spawner to create events in the world, and it seems that there is no way to know if I have spawned an item in other maps. Therefore, I believe the best approach is to iterate through all of them.
How can I do it?
you cannot - but spawned events are not stored in the mapfiles either, because those are basically read-only.
Only one map exists in memory - the current one. Transfering to a different map deletes all current map data and loads the next map from the data-files.
This also means that the event spawner stores the spawned events outside the mapfiles - and that is the data structure you'll have to iterate.
Unfortunately I don't know where or how that plugin stores its data, but it is completely within the plugin code where those parts are.