This would give you the "is locked or not" capability you seek here, but obviously requires a replacement of your door lock (perhaps not trivial if renting, but is a very easy DIY otherwise).
That sounds like it could be a lazer/ir gate in the lock hole to detect it being in the way, but the custom job to jam it into the frame side of the lock might be quite delicate work if it's wood, or even worse if the frame is some prefab unit. Another DYI alternative would be to open the lock and see if you can stick a magnet somewhere in the mechanism where it won't impede movement and that has enough space for the solenoid. Neither of these are what I'd call complex, but also wouldnt call them easy to pull off. I would have to assume that somewhere out there someone is selling this already made.
I have a few Emtek locks which support locking and opening detection. Premium brand from Yale, which has a Yale Zigbee module. They also have Zwave support.
https://www.schlage.com/en/home/smart-locks/connect-zwave.ht...
This would give you the "is locked or not" capability you seek here, but obviously requires a replacement of your door lock (perhaps not trivial if renting, but is a very easy DIY otherwise).