It's not difficult at all, food products all have factory + machine origin coding on all packages. If something makes you sick you can easily pin point which region and even which exact factories were used.
If there is an outbreak there are multiple pin points, it's also not hard to do this with local market goods either (unless you live in Texas or something where there are no regulations).
Why do you think this is the first time we've dealt with such situations? The only reason why it's happening now is because Elon Musk had his DOGE goons gut the programs that monitor our food supply.
I hope those DOGE goons have deep pockets because they are about to find out what happens when your supposed benefactors abandon you.
The problem is typically you ate a bunch of things in the time before becoming ill and don't know which one (or none) is the culprit. So it takes a government investigation to identify the cause by correlating many different victims' food consumption to find the common factor.
Even when it's totally obvious the cause can be hard to actually prove. A restaurant near me put several people in the hospital with a certain kind of mushroom a couple years back but investigations never conclusively proved the source.
This type of outbreak is challenging because the symptoms take weeks to appear.
(I don't disagree that an administration focused on widespread carnage can be blamed for making things worse.)