The Chinese made cakes as offerings during harvest time to the Moon Goddess (Heng O) -- they recognised the role of the moon in the seasonal cycle and so made their cakes a round shape to honour the Lunar Goddess---in fact, the Chinese still make moon cakes today, out of rice and eat them at the Harvest Moon festival every August 15th. According to legend, Heng O ascended to the moon after swallowing a pill of immortality and remains there to this day. Along with a lunar rabbit that makes rice.
The Russians make cake offerings in Spring to a deity 'Maslenitsa' by making blini -- thin pancakes they call 'sun cakes'. She was the daughter of Father Frost (who brought the winter) but unlike him brought warmth to the peasant villages. When she was around she kept the people warm and happy -- but when it came time for her to move on she told the people to eat the sun cakes, saying that this would keep the spring in their hearts forever.
The ancient Celts also made their cakes round to honor the spring sun, which they ate at Beltane on the first day of spring -- to ensure the sun would continue to move on its proper path. They also rolled cakes down a hill to imitate solar movement. They hoped that this would ensure the continued motion of the sun.
The Celts also originally used cakes to select victims for sacrifice -- the bakers would blacken a small part of the cake with charcoal, and whoever got the blackened piece became the victim.
The Ancient Greeks left cakes at crossroads to appease the evil god Hecate, and the Estonians threw cake into the waters to appease Nakk, a dangerous Estonian water spirit
People often made cake offerings to spirits of the dead, believing that the cakes would nourish them in their long journey to the afterworld.