There are "things" which make it into the dough before, during and after it is mixed. Then you add the "things" that make their way into the product throughout the process. Couple that with the process itself.
I will use pretzels for an example. It depends on who is making the product, whether they are using a batch mixing process or a continuous mixer. I will use the batch mixing process as an example. Flour is dumped in automatically from the silos (or holding hoppers above the mixer). Bugs can appear in the flour. Sometimes, they are alive at this point, other times they are dead. The operator of the mixer adds the ingredients by hand. I have seen operators sneeze, wipe their mouths and noses with their hands, and then immediately touch the raw ingredients as they put them in the mixer. I have also seen operators handle rat traps (with rat poison in them) and then touch raw product. After everything is mixed, the dough is emptied onto a conveyor for further processing (about a 600lb batch). Flies have been trapped in the dough as it is exiting the mixer, along with the aforementioned operator using their hands to get the dough out of the mixer.
Jump ahead in the process. Flies have been caught in other parts of the process as the pretzels are shaped and are moving through the system. The pretzels are then put through a caustic solution (NaOH or soda ash). This solution is what gives the pretzel the dark exterior while maintaining the white interior. It is also what gives it the crackery texture. Well, plants usually run 24/7, which gives very little time to clean this solution. The solution becomes very dirty and sludgy. Take the skankiest river you know, and imagine your pretzel dipped in it before it is baked.
After it goes through this cooking process, the salt is added. You do not even want to know what I have seen in the salt bins. It then goes into the oven, where most of the moisture is removes (down to about 11%). At the back end of the oven, it transfers to the kiln for drying (to the final moisture of about 3-5%). This transfer point contains a LOT of dirt, dust and grit. It also contains stale product and anything else that gets caught.
It then transfers into packaging where more stuff can be "added," especially if they are bulk packing.
So, anyone want a yummy pretzel?