Deployment fails with duplicate value found: duplicates value on record with id: error

Summary
Metadata Deployment fails if there is history tracking in custom lookup field with look up filters, when the filter refers to a field with tracking to custom object in the same deployment transaction.
Repro
1) Create a custom object foo__c with a custom field field a__c and enable history for the object and track the history for the field.

2) Create a custom object bar__c with a custom look up field b__c, where b__c has a look up filter foo__c.a__c, history is enabled for the object and history tracking is enabled for the field b__c.

3) Deploy the package including the two objects and there is an error : duplicate value found: <unknown> duplicates value on record with id: <unknown>
Workaround
a) Deploy both the objects in different transactions so there is no error.

b) Remove the History Tracking on the custom field and then deploy. Once the deployment is completed, history tacking can be enabled on the custom filed as part of post deployment step.
c) Remove the components(fields and objects) if already deployed

Counters