Typically, and USA specific, the rules are to grind it up, mix with equal parts existing dirt/compost and then it's OK. So that dilutes it by half; then this compost is spread around and, like you said, can be used for other crops. Also, as the material sits in the compost pile, which should be agitated, the pesticides will leach out/break down.
Many asterisks here but there are methods for remediating herbicide and pesticide contamination. Not saying it’s universally solved, but its not universally unsolvable either.
Edit: I meant to speak specifically in terms of compost production.
Although, to your point, they can just sell it to the nearby farms growing stuff we eat that isn't tested the same way...