In the provided test case the PathDiagnostic compare function was not able to find a difference.
Here is my improper fix with test case. Since CTU is still an experimental feature and this is a rare case to encounter I believe it's okay to risk confusing the user, rather than keep it broken.
Unfortunately I will not have the time to work on a proper fix.
My fear of using file IDs is that I don't know whether they are stable
IIRC they are currently stable, but that's relying on implementation details.
Still better than not differentiating at all.