I think it’s that people like certain levels of specificness. Like, bread, pizza, and broccoli are all foods, but if you said “I had a food for lunch” that’d sound weird.
It’s not necessarily that cake isn’t a type of bread or that the two aren’t closely related. It’s that we have a super-common and more specific word for it (cake) so it sounds awkward when you use a different word that might be technically accurate, but is a weird choice in practice.
Same for a lot of things. A hot dog and a sub are technically the same thing. But if a waiter dropped off your hot dog and said “here’s your pork sub”, you’d probably look at them funny.