Sync paired each declared index with the first existing index that had an
equal definition and did not mark that index as taken. Two declared indexes
with the same definition could therefore claim the same database index: the
other one was dropped as unmatched and never recreated, or a missing one was
never added.
Claim an existing index with the same name and an equal definition first,
then let the remaining declared indexes fall back to any unclaimed existing
index with an equal definition, so renamed indexes are still kept as before.
Iterate in name order so the result no longer depends on map order.