They must have came out of the fruits. The moment they came out they will try to mate.
The fruits will ripe and fall down to the ground.
This time around the fruit flies will start their breeding cycle on the ripe fruits.
So you have two sets of insects breeding on and below your figs tree.
Please enjoy the video clips below:
One more with the view of the whole tree. If you look carefully you can find the followings:
1) The fruits are all over the branches.
2) The fruits are ripening and turning black.
3) The whole tree was filled with figs wasps flying all over the place.
4) The tree is not that tall but full of fruits.