Must just be RNG, since all the time's I've run it my squads never got that low from the flies. I actually was wondering if anyone had a good setup to keep them in the ring as long as possible to get more coins/seeds (but I think it's mostly just RNG). The final boss doesn't have that much health anyway, so if all your squads + helper get off at least 1 round of attacks + at least 1 solar blast, it should die as long as you have enough power (and that's a pretty extreme example).
Do the flies do a flat amount of HP damage or is it % based?