Shrieks in terror - a home full of battery powered ZigBee devices! All these complicated solutions being suggested.
This may not be required. Look at what you have already and what you need.
You already have functional switches, with hard wiring going back to your switchboard to drive your relays. Why replace that nice reliable solid and already functional wiring with a scattering of radio connections and all the associated (probable) unreliability and pitfalls?
A simple voltage divider [two resistors] to drop a 12v signal to 3.3v on a GPIO will detect your switch position with a ESP32. One GPIO per switch input. That takes care of the input side. [Be sure to configure as switch to take account of debounce factors.] Do this at the switchboard, all in a central location. Don’t even touch your existing switches on the wall - they already work!
Disconnect your wall switches from the 12v relays at the switchboard, and instead drive the relay inputs at 12V from a HomeAssistant connected relay board, one relay channel per switch, maybe even using the same ESP32 chip with other GPIOs. Multichannel 12V powered relay boards already configured to work with Arduino/ESP32s are very cheap and come in various configurations to support 1, 2, 4, 8 and even 16 channels. Their outputs should be a 1-to-1 connection for your existing relay inputs that you have disconnected from the switches. That would mean cutting the connection from the switch to the relay input and interspersing your smarts in between, only two wires for each switch, and maybe take off a 12v/GND to power your ESP32s and relay board as well.
All your wiring is at the switchboard. Low voltage. No batteries, no tampering behind each switch at the wallbox. No ZigBee configuration, intermittent fadeouts, hubs, or firmware nightmares. When you move house just take out your ESP32 bits and connect the 12v wires back again.
If you run out of GPIO pairs, just add more ESP32s and relay boards. What you have done is logically broken the link between the switch and the relay, and substituted with your own.
Configuring switch inputs and relay outputs using ESPHome should be your biggest challenge.
Simplez!
Out of curiosity, how many switches/relays are we talking about?