In nature, both the antiparasitic and the parasite will have a tendency to end up in places that you don't necessarily want them to be for the purposes of motivated hypothetical reasoning.
aka the chicken will urinate out some amount of ivermectin, unprocessed by the chicken, and then some amount will make it elsewhere that will allow for natural selection to take place (eggs or wherever). Once is infinitesimal, but give every animal some ivermectin for funsies, and you've now bred ivermectin resistance.