wg-quick is handling all this:
https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8
No need to modify any source or write a daemon.
At this moment how do you handle wg interface UP/DOWN commands? I think with wg-quick.