I admire the ingenuity. There are A number of solutions for the problems you described, all discussed in the community FAQ, but there’s no question that most of them are more expensive.
Separately, as far as older homes that don’t have a neutral wire at the switchbox, the lutron caseta switches work fine without a neutral wire. (Lutron is an engineering company dedicated to improving lighting systems and has multiple patents on their devices, which is why they can do what most other companies cannot.) there is now an official integration with SmartThings which works well, but it does require also that you also buy the lutron smartbridge, so again expensive.
https://support.smartthings.com/hc/en-us/articles/115000864766-How-to-connect-Lutron-Caséta-devices
Now as to this specific project.
Dang, I hate to be the bearer of bad news, and ordinarily I avoid it, but fire safety is a particular concern of mine and if you search the forum for other similar projects over the last couple of years you’ll see that I’ve made the same comments there.
If you check with your local jurisdiction you will probably find that it is against code to bury a battery operated device in the switchbox as you are doing here. Unless such a device is specifically designed for that purpose, which hardly any are. Batteries outgas, they can corrode, you don’t want them inside the wall. And if you burn down your house because of such a device and it is against your local code, your homeowners insurance will not cover your losses. So this stuff is important.
This is the reason that all of the commercially-produced battery-operated light switches, such as the Hue dimmer switch, the Hue tap switch, and the Cooper 9500 anywhere switch are all designed to mount on top of the wall. Not inside of it. I guarantee you that if it were to code to put those devices inside a regular wall switch, they would’ve done it. The fact that they didn’t tells you a lot.
Cooper even went to extra trouble to make their designs superthin and add a spacer for their regular inwall switches so you can put them side-by-side and both look like they are inside the wall. But the battery operated one is not.
You can use the contact sensor as a battery operated switch and still be to code, and some community members do. You just have to mount it in a box above the wall. Not put it inside the cavity where the other wires are.
Again, I do really admire the ingenuity and I’d like to see you do something similar that was surface mounted and not connected to the home wiring.