The solution I've come up with but haven't yet put into action is to use an ESP device, with some sort of contact switch which sits _in_ the hole where the lock goes and detects whether the lock (bolt?) is physically present.
This solution isn't likely to be pretty, unless it could be shrunk down to fit within the "hole", but I imagine some sort of ribbon coming from the "device" which should ideally look/be sized similar to a door/window sensor, and goes into the opening in the frame; Main concerns for a DIY solution are battery life and longevity of the switch/contact being smashed into by the lock/bolt each time.
EDIT: A sibling comment mentioned reed switches and magnets, which I had considered, but felt would be either too bulky (reed switch plus magnet) or too fragile (do reed switches come in non-glass form?).