Transparency problem

I got a transparency issue. If this laser barrier is behind the distorting glass, it looks fine. If it’s in front it gets distorted but it shouldn’t.
I set the laser material to “render before DOF”. If I disable that it looks fine in front of glass but bad behind glass. (Also it doesn’t get blurred in DoF then).
So it’s bad either way. Is there a way to get this right both ways?

That is expected, because if you render translucent object before DOF and use distortion, distorted scene color already contains your object. You can use refraction bias to some extent to minimize it, but overall, this is the way it works.

Ok, but how can you make it look correct in all cases?