Complex sentence: When the flies see female larval endoparasitoid wasps, they switch to laying their eggs in rotting fruit that contains alcohol; which protects them from becoming host to the larvae, as the wasps have a low alcohol tolerance.
Split into simpler sentences: When the flies see female larval endoparasitoid wasps, they switch to laying their eggs in rotting fruit, which contains alcohol. Doing this protects the flies from becoming host to the larvae, as the wasps have a low alcohol tolerance.