on a tankless water heater how far away from the water outlet side can the Watts relief valve be?

It doesn’t matter how far as long as there is no valve/shutoff between the heater and the pressure relief valve.

There was a shutoff valve before the relief valve that I noted as wrong.

I was curious about the psi rating of cpvc over the psi rating of the relief valve.

at higher temps the psi rating of cpvc decreases.

What would be the probability that the line or a socket joint fails before the relief valve operates?

Unlikely at best.