That’s the way the cookie bounces

English: A Pepperidge Farm "Nantucket&quo...

English: A Pepperidge Farm “Nantucket” cookie. (Photo credit: Wikipedia)

This is a straightforward malaphor, mixing “that’s the way the cookie crumbles” and “that’s the way the ball bounces”, both meaning you can’t control everything that happens to you.   It also could describe the rejects from cookie exchanges this time of year.