Found the solution, which is actually using the ApplyDepthOffsetPositionInput function (which is in Common.hlsl), which recalcs the position and hence the depth as a byproduct of that. It needs to be enabled with Pixel Displacement On in the material (which wraps _DEPTHOFFSET_ON).