I once got pulled over by a cop and due to a mixup with the insurance company (I did have insurance but the company failed to report it) I wasn't allowed to ride my bike home.
Well as it turns out where I was pulled over happens to be right next to krispy kreme, which happened to have a fundraiser by wait for it... cops! I ended up riding my bike there and waited in the parking lot so that my friend could come pick me and my bike up.
I think the reason behind the doughnut stereotype of cops is that it's a cheap and easy snack. Cops don't make 6 figures and they just can't afford to hang out at the local caviar and wine tasting shop. Plus another factor is doughnuts are a fast and easy snack so in case they get an emergency call they can bail out right away instead of having to throw away their meal.
I even notice a lot of cops when they park their car they reverse into a spot so that they can quickly leave if they get a call.