Can a thermal expansion tank be install above the water heater?
They make heat trap valves, which come already installed on some water heaters. You could use those instead of the pipe loops, then you can route the pipe however you like. You should be able to find a set of heat trap valves for ~$10.



Also, there may be alternative installation diagrams in the manufacturer's installation instructions.

Expansion tanks can be installed up, down, or on their side. However, if they're installed on their side, support is required.