Hey, this problem is fixed with this commit: https://github.com/EpicGames/UnrealEngine/commit/22be0c55959355bbf6dca097a3db1032d3e1c6ca
Some context for the interested: The reason this doesn’t work in 4.26 is because the behavior changed for how the custom depth texture was read in the custom depth pass itself. Prior to 4.26 it would always return far-plane value (because it was sampling a default 0 texture and calling ConvertFromDeviceZ() on it) and in 4.26 it was changed (as an optimization) to simply return 0 and not sample any default textures.
Anyway, the fix is a simple change to MaterialTemplate.ush, so you can simply apply that change to 4.26 and restart the editor to get the old behavior back.