This common fly originated on the steppes of central Asia, but now occurs on all inhabited continents, in all climates from tropical to temperate, and in a variety of environments ranging from rural to urban. It is commonly associated with animal feces, but has adapted well to feeding on garbage, so it is abundant almost anywhere people live. From here.
It would seem that they existed well before us (and houses) but have evolved to take advantage of our messy lifestyle.