Well, IIRC there were stages to trying new things, kinda like:
Test 1: rub plant on forearm, see if it has a reaction.
Test 2: eat small piece of plant/thing to see reaction
Test 3: eat progressively larger pieces and rinse and repeat
I feel like dogs and kids are best described as ultra voluntary test subjects, they will try their damndest to eat the thing and you can certainly try your best to stop it.
They’d also dilute them in water and drink progressively less dilute solutions. Also, as other people mentioned, notice what other bugs and animals are eating.
It's also more realistic to think that humans gained this knowledge from their ancestors. It's more likely humans learned these things from other humanoid species