Expansion tanks can go anywhere in the system provided a clear path exists to the WH, ie, no check valves, heat trap nipples with ball valves, etc. which would prevent expanding water from reaching the ET. That being said, the bladder in the ET will last longer if not exposed to hot water. So if installation on the cold side is impractical you can put it on the hot side. If I were plumbing an ET on the hot side, I would build a long heat trap so the temperature would not get to the ET. If you can’t build a long heat trap, get some reducers to build a fat one, or some tees and elbows to create a manifold. Either way will give you an increased volume of water between the hot line and the ET. Other posters might say a 6 inch vertical “U” might be sufficient.
ET failure: The bladder is the first thing to fail. When it does, the ET is no longer an ET, it will go solid as the air dissolves into the water. It will take additional time for the shell to rust through. Local area plumbers might be able to advise as to how long an ET will last before failure. My well tank bladder failed at 5 years on a well with 4000 ppb iron and quite hard.