Definitely some sort of fly (order Diptera). Specifically, you found the legless larva, or maggot, of a fly that then developed into a pupa.

Source: Univ of Florida IFAS
The above picture represents the life-cycle stages of the common house fly (Musca domestica).
M. domestica is one of the most common and widespread flies in the world:
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. Source
According to Wikipedia, M domestic larvae take 2-5 days to metamorphose into a pupa.
Although the OP mentions that a housefly emerged from the pupa, I'll caution the OP that many flies look like house flies to the untrained eye. Houseflies typically deposit their eggs in fecal matter or dead flesh, so finding a maggot deposited into the body of a living millipede seems unlikely behavior from the common house fly. (Edit: Though I see now that the OP said the millipede was dead, so this is not an unlikely candidate).
IF the larva was deposited when the millipede was still alive, then other genera would be more likely.
One example would be a Sarcophagid (or flesh fly; family Sarcophagidae), which some species being known to be internal parasites.
As for proper ID, according to Wikipedia:
Generally, only males of this family can reliably be identified to species, and then only by examination of dissected genitalia. The literature is incomplete or scattered for all regions
Here are some images for a fairly widespread species, Sarcophaga crassipalpis (which is very unlikely to be your species, but demonstrates general appearance of this family):

Source: Univ of Florida IFAS
Your specimen might still belong to another group of flies, the tachinids (family Tachninidae), which very often parasitize other arthropods.
It'd be very difficult to differentiate most of these taxa without up-close examinations of specimens.