Set#map Deduping and Possibly Unsafe Behavior

I’d like to propose slightly different approach to solve this otherwise unsolvable problem.
Please take a look at issue I posted recently:

Code snippet showing how it addresses problem described at the beginning of this discussion:

m.