In a garage on the floor.
I think the code is 'within the top 6" of the heater'. I would have installed a male tee or a close nipple/female tee and taken the hot water off the tee middle leg.should be on top of the water heater........ what a mess !!