When you leave flowers on a tombstone they look good at first, but after a few days or some harsh weather, there's nothing left but stems. That's why you have to replace flowers on tombstones all the time. If you don't it will look like you only left the stems there, and that's pretty disrespectful.
You have an idea that can make these tombstones look better than just having leftover stems all over them. You brought cookies (くき)! Cookies don't fall apart in the wind, and everyone loves cookies, alive or dead. You replace the stems with the cookies and everything looks a lot nicer.