How to automatically configure a p2p network device on the host?

You should be able to use a udev script on the host to have it trigger running your script whenever that network device shows up.

If on a systemd system, I think you can also do that with a systemd unit and a condition that makes it trigger when a veth0 device appears.

At the LXD level, you could write an events API client that will trigger when the startup event for your container triggers, but that’s very likely overkill for this use case, the udev or systemd approaches should be much easier.