Preserve UID relations on anonymization

This fixes an issue where UID references which used different tags than
the original were given a different UID. As of this commit, complete UID
anonymization of studies/series should be possible, while keeping all
references intact.