Could you "tag" one of the duplicates (by changing or adding just one piece of information) and see where the modification propagates to. Watch for:
- The duplicates all show the modifications.
- The account on which the modification occurs (iCloud, Gmail...)
If the modification occurs on iCloud, turn off Contacts in Settings > [your name] iCloud on all your devices except the Mac. When prompted, choose to erase the contacts (don't worry, they are still stored in iCloud).
On the Mac, repeat the duplicate elimination procedure. Note that you may have to do that several times to get rid of all the duplicates. Then go to iCloud.com and see if the duplicates are gone.
If so, on just one of the other devices, turn on Contacts in Settings > [your name] iCloud and observe what happens with duplicates. If everything looks good, turn on Contacts on th remaining devices.