This is wrong. The energy is proportional to the height, not its square. You would get wrong units otherwise.
The energy is proportional to both the height and the mass. The mass is proportional to the height itself. Hence the energy is proportional to the square of the height.
If the fill level is h, so the weighted average of the mass is at h/2,then
E = m * g * h / 2
m = V * r
V = A * h
E = A * r * g * h^2 / 2
m2 * kg/m3 * m/s2 * m2 = kg m2 / s2 = J
It works out to the same 50% because the analogy is just very good. Dividing over two barrels/capacitors means halving the potential level (amount of water/load doesn't change), which means 1/4 of the energy in each barrel.