Problem with ID mask and glow effect
First method (recommended):

This one is pretty simple, you can use Z-Depth value to 'hide' layer (yellow) behind mesh.



Second method (with manual Glare control):

If you for some reason would like to hide Glare effect from the front part of the mesh you could use Mask and manually place it on your image.