If you are squeamish and like figs, this may comfort you. According to a comment in the original post, majority of commercial ones do not contain insects: "Only some kinds of figs (so called 'Smyrna' types) are pollenated by wasps. The vast majority of figs eaten come from varieties that produce fruit parthenocarpically. It is highly unlikely that the fig you ate at the supermarket was of a variety pollenated by wasp…
Essentially a mutation that gets trees to produce useless fruits that don't have actually developed seeds and don't need pollination. While that sort of mutation would normally be selected against, since the trees can't reproduce via seeds and are expending energy on producing fruit for no reason, it's deliberately selected for by farmers who artificially reproduce the trees via planting cuttings, or grafting them onto rootstock.
(Though I guess really the "naturally" versus "artificially" distinction is a bit, erm, artificial, if you just think of humans as another species, since lots of natural selection is influenced by relationships between species, like the wasp-fig relationship in this article. So trees evolving to please humans isn't really different in kind from trees evolving to work well with wasps.)