Buying gold Vs staying with CHF

I am always confused about Gold
As far as I understand the “real” expected return for Gold is Zero. This makes sense because you can only gain value from Gold by selling it as it is a speculative asset. There is no other cash flow and only way anyone can gain profit from investing in gold is if they can find a buyer who believes Gold price will go even higher. And then this chain continues. This also means that only way for someone to pay more money for Gold coin is that they have earned that money somewhere else (by using a productive asset or contributing to enabling a productive asset).

Does it mean its main purpose is to benefit from rebalancing during times of distress? This means in bad times gold goes up and stocks down and then rebalancing creates ability to buy more stocks