There are many reasons for this problem and one big one is the geography involved in food production. Living here in Fort Worth, Texas you probably don't think that a slip up in New Mexico would affect you in the least. The truth is, because of modern food processing methods, products at say Trader Joe's on Hulen Street could have been made practically anywhere in the USA...just as the beef in your fast food burger could potentially come from a large number of cows (from a large number of suppliers). That's the way it is with manufacturing huge quantities of food - and supplying an entire nation's cravings.
In addition, products can be available on store shelves for months before the alarm is sounded. That's why you'll often hear that an item was sold for a good amount of time before being recalled. And although the codes on the cans, boxes, and bottles can be tricky to decipher, be on the lookout for the specific codes included in the recall alert. They will let you know if the item in your pantry or refrigerator is suspect.
So, what's to be done about this on your end? It all comes back to a couple of basic steps:
Buying locally produced foods from smaller suppliers can help. A company which makes enough of their product to serve a specific region may be able to exercise more control over their raw materials and processing methods.
Purchase food items which are as close to their original form as possible. Yes, this can mean a little more hands-on effort when preparing meals, but it does provide a means of controlling ingredients and reducing the excess salt and sugar (which show up in the most unlikely processed foods).
In addition, being a little extra careful about food safety at home can help minimize your exposure to potentially harmful "bugs" as well.