Since the beginning, R2-D2 has been one of the main characters of the Star Wars franchise for many reasons, he is adorable and has a positive attitude. This makes him the perfect device for holding and distributing ‘cookies’.
Kids love R2-D2 and cookies, so it just makes logical sense to have him as a talking/beeping cookie jar. The sounds that this little droid makes are authentic from the movies, so both kids and adults will readily recognize that R2-D2 is ‘in the house’, even if he hasn’t been seen yet.
For parents, the beeping noises R2 makes act like a cookie warning system that lets them know when someone has their hands in the cookie jar. Like little rebels who want their sweet freedoms before eating their main Empire meal, Darth parents are alerted by the beep-boops and whistle noises and are able to crush the cookie rebellion… before it starts.