MSAA breaks post process material that compares scene depth and custom depth

Hi . Here is the project.

https://www.dropbox.com/s/f5b0xfzi5yi65d9/MSAADepth.zip?dl=0

Just toggle between MSAA and FXAA/TAA, and the issue should appear.

The posts from the material’s page are mine, as is the workaround which I found after I made this post. However the workaround is noticeably less accurate and doesn’t fully solve the issue.

Basically the issue seems to stem from this:

This is a screenshot taken from another project. One under MSAA, the other under FXAA, while using the post process material below. The depth comparison produces entirely different (incorrect) results under MSAA.