Transparent Depth and Transparent Node not working
I believe the issue you're having is due to a circular dependency.  You're counting the number of Transparent Shaders the ray is passing through, but what happens when the material that that number depends on is a Transparency itself?  I believe that's why Blender creates a Null shader.

You can do something similar with a Glass Transmission Shader set to IOR of 1.0 for your "transparent window" thingy.  Disable everything but Camera in the Cycles Setting:



Then instead of Transparent Depth, just use the Transmission Depth input for your object: