Options for powering 5 V from 24 V AC relay switch
If I understand right, it looks like the question is, you have a small electronics box (like a remote control or thermostat) that needs 5VDC and has outputs to control relays. You want to use it to run relays that will switch 24VAC.

It's certainly possible to get 5V from 24VAC, but I think in this case it's going to be easier, cheaper, and more reliable to have a separate 5V wall wart. 

Cheaper because: if you need &lt;2A of current, you can get USB power supplies on Amazon for under $10. Power supplies that run off of 24VAC are less common and therefore more expensive.

More reliable because: the switching creates voltage spikes on the 24VAC line, so if your 5V electronics are connected to the 24VAC, it might take a little bit of extra effort to protect them from voltage transients. In industrial systems, it's good practice for different components to be galvanically isolated whenever it's possible to do.