I’ve heard the phrase many times and have known exactly what it means from context, and could even use it properly, but the actual words of the phrase have never made sense to me until I googled it right now.
It just never made sense because in my mind in order to “eat cake” you need to “have it first.” You can’t eat cake unless you have cake. Why on earth would anyone not eat the cake that they have or at least go as far as saying you can’t eat the cake that you have.
With more Google explanation today I understand that it really is saying that you can’t have cake if you have eaten it all already. Too bad the saying itself doesn’t make sense.