After thinking about this overnight, I think my suggestion is more than you need. All you need to do is run a single field edit on identifiers over all the books. The template would generate the 'right' identifiers and return those. If there are no changes then return the existing identifiers.
The template would implement the equivalent of the three S & Rs, manipulating the list directly. Here is a sample template that does the first and the third. The second is a near copy of the first.
Code:
program:
publisher = field('publisher');
ids = field('identifiers');
status = field('#fanficstatus');
u = select(ids, 'url');
if publisher == 'Archive of Our Own' && u && status != 'Anthology' then
ids = list_difference(ids, strcat('url:', u), ',');
n = re(u, '^.*/(\d+)$', '\1');
ids = list_union(ids, strcat('ao3:', n), ',')
fi;
if 'Completed|Oneshot|Abandoned' in status && u &&
(select(ids, 'ao3') || select(ids, 'ffnet')) then
ids = list_difference(ids, strcat('url:', u), ',')
fi;
ids