Alpha masks will not work for this
Alpha is for blending one image on top of another so it will not work with light, because light should be added, not blended, but you can separate only the light information.
Separating light information
To separate light going through the glass object you would need to render it and then render a version without it. In this case it happens that the light that we need is going through glass, so if caustics are disabled the render will come out without it. Or if you wanted the light to be only from a specific light source you could disable the light source instead. You should just subtract the image without the light from the image with the light and you will be left with the light information that now could be added to another image. Note that it is important to work with 32bit color depth here.
Separating glass
Glass is a lot harder to separate since it has refractions and internal reflections. You can have a look at this post, but I ignore internal reflections here. the refractions are also not completely accurate, because they come from a plane and not from realistic directions. To have more accurate results, it would be possible to separate glass to components like internal reflections with render passes and light paths node in the materials so it can be reconstructed in a more acurate way with different refractions. That gets a bit complicated, let me know, if you wish to explore this further.