Compositing: Get mask of glass/ transparent materials
You need to set Alpha Threshold to 0, then all materials will be equally solid as ID Masks. Don't know what you're after with the set alpha nodes, but they don't do anything in this node setup so you can skip them.