Fix DuplicateAnchorException when using merge keys do merge mappings that contain aliases.

Implement merging a sequence of aliases.