I discovered this by accident while fortifying a cathedral by building metal bars around the stained glass (I only later realized that they were already pretty secure). It appears that stained glass windows will let light through if and only if they’re surrounded (at least on one side) by other transparent terrain.
Image for reference. The windows on the left (and on the upper right, out of my line of sight) have metal bars covering them, and are transmitting light. The windows on the bottom left and on the right do not have bars covering them, and do not transmit light. Note that there is another set of bars in the tile south of the northwest window, and that that window did not transmit light until they were built.