on a perfect fruit tree's last harvest, it will produce 1 rotten fruit. i dont think they attract flies, just ants. i got my fly from a spoiled turnip.
Flies are only attracted to trash that you fish out of the ocean like old cans and boots, and rotten turnips. Rotten fruit is for ants. If you have the beautiful town ordinance then you won't be able to fish up any trash, so the turnips are your best bet if so ^^
Fruit will not rot on the ground, they are only considered rotten when they are first spawned on the ground. Fruits don't change their conditions in any way.