Well, 3D stroke is not actually a 3d object, so it can’t interact with any 3D layer from After effects, the only way to simulate it, is masking as people told you.
Pre-compose the 3D Stroke layer so it is consider as a flat video and then, duplicate it and mask one to the foreground and another for the background.
Good luck.