Auxiliary contacts on contactor to power solenoid valve
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. SW1 - 3 are the contactor contacts. SW4 is an auxiliary contact.

If the solenoid is adequately rated and the PSU has adequate spare capacity then your plan is fine. Make sure that there is no chance of accidental connection between the mains and DC circuits. Check the 24 V supply voltage with solenoid off and solenoid on. The PLC isn't switching the solenoid so it won't be at risk.