Anciently people didn't have enough food and eat nuts, berries and fruits for their snacks, distinguishing form their staple diets. Then they came to call those snacks "sweets". In those days, they had no skills to process food, so they regarded sweets which were originally sweet, as the special food.
Then, they acquired the skills to reserve food. For example, they dried nuts in the sun, and crush them with millstones, rubbing stones and stone hammers. In those days, they ate acorn too, but it has too harshness to eat just as it is. So they crushed and soaked in it to skim lye, make it a ball and heat it. It is said that this is the origin of the current dumplings. In this way, the kinds of the preserved foods have increased.
They also acquired the agricultural technology. And Then, the "rice cake" was made, which is regard as the oldest Japanese processed food. It has rice in it for the ingredients, actually rice is very very important in those days, so the rice cakes were regarded as the divine food.