There are a few other options that are pre-made, like this [1], or that offer guidelines for DIYing it [2]
[0]: https://esphome.io/components/climate/thermostat.html
If a person has enough stuff in front of them to make a relay reliably click on and off, then they also have enough stuff in front of them to make a conventional forced air furnace turn on and off just as a thermostat would.
But a relay is already an isolator: There's no path between the switched contacts and the coil of the solenoid that switches those contacts. The coil doesn't know or care how much current or voltage the contacts are switching: It's just a coil that moves a little bit of metal using electromagnetism.
And, sure: It takes more power to drive a relay's coil than it does to drive an LED inside of an optocoupler, but at some point that coil still needs to be driven by something that can accomplish that small amount of work.
Adding an optocoupler just seems like adding extra parts to a circuit that would be simpler without.
KISS?
I usually specifically look for smart devices like this because I dislike the idea of them phoning home for "analytics" or "to enhance my marketing experience" and just firewall them off.
I'm not sure if it's explicitly required, but I've yet to encounter a HomeKit device that didn't work when prohibited from talking to anything outside the LAN.