If you have what I think you have, it is unsafe, won't meet code, and definitely needs to be redone, but not quite like you're planning. Galvanized fittings in potable water will ALWAYS end up rusting. IT can take awhile, but it is essentially inevitable. Never a good idea.
It appears that you're taking your hot water out from the port designed to hold the T&P valve (what you labeled as the pressure relief). If that's what you have, that creates several issues:
- the top outlet will have the hottest water for longer, by tapping it below, you'll not get the full hot water volume out of the tank before it cools off
- more important, I think that you'll find CPVC is not rated for water above about 200-degrees. The T&P valve doesn't open until it gets to 212, and could get hotter during a fault. I don't think you'll find using CPVC is a good idea for that drain line! And, the probe from the T&P valve should be poking inside the tank, not in that branch outside.
So, does the WH have a top outlet? If it does, take your outlet from that. Relocate the T&P valve where it's supposed to be in that side port (on some, it is installed in a separate top port), and preferably, use copper as the outlet. If the instructions allow cpvc, okay, but keep in mind, if that ever does open as a result of overheating, it could be spewing steam, and that could cause all sorts of safety issues if the pipe gets damaged in the process.