Change location of water heater
no. my house has had a much longer capped hot-water stub line for 50 years and there have been no problems with it.
In the dark inside a pipe clean water does not become stagnant.