Tom Bombadil and Praetorian give clear reasons why cookies win. Pie, on an individual level, is arguably better than cookies. However, pie can also be underwhelming. I've had bad pie. Too many things can go wrong with pie. Bad crust, bad filling. Too many variables. Cake never lives up to the hype and really needs to bring it's A game more often. For every good piece of cake I've had there have been four pieces of lackluster cake. Brownies? Seriously? It's just pretend pseudo-cake. Donuts? While the donut place by my house has an amazing peanut butter donut I can't even tell you how many crap donuts I've had. The fact that the donut crowd holds Krispy Kreme up as the gold standard of donuts should say everything about how well the donut crowd can judge things.
Yes, the best pie in the world is possibly better than the best cookie. However, as Tom said above cookies are the stronger team. Cookies are smaller. Bite size, travel capable, enjoyable warm or cold, delicious crunchy or chewy, frosted, with chocolate, with peanut butter, toffee, shortbread... C'mon cretins! It's everything you want in a tiny morsel. I guess if you like American sized portions of diabetes you'd pick pie or cake, but you're so clearly wrong.