CAKE DECORATING TRIVIA
The following is only speculation on my part. I wrote it in reply to a question on the origin of cakes from a student subscriber.
Cake decorating most likely began thousands of years ago, soon after the first baked items were made with ground flour. The temptation to sprinkle something on top of a flat blank surface would appeal to any human with artistic inclinations.
It also depends on what you mean by "cake" - fruitcakes were made by the ancient Egyptians, and cheesecakes in ancient Greece. But these were not 'raised' cakes as we know them today. The first light airy cakes would have to wait until someone discovered beaten egg whites added to batter would make a fluffy light textured cake. Ancient Romans were adding butter, eggs and honey to dough, which produced something we would recognize as a 'cake' today. Again, soon after the first cake would come the inclination to put something on top. Especially for special occasions such as birthdays, weddings, Easter, Christmas, etc.