Galaxies like the Milky Way indeed could not have formed as a unit at such an early era after the Big Bang. The time span for sufficient dark matter and gas to collect into a unit bound by gravity and with active star formation would be too long.
So what do we think happened in these early times? The universe was much denser (likely by a factor of more than 1,000) when dark matter began to make the first seeds of galaxies. The first galactic objects were smaller and denser than present-day galaxies, and thus could collapse and pull in gas on timescales of tens, rather than hundreds, of millions of years. Once gas compressed inside such a protogalaxy, stars could begin to form — an especially tricky step that is not fully understood — and then galactic evolution could proceed quickly. For example, very massive stars burn their nuclear fuel in less than 3 to 5 million years and explode as supernovae, spewing out newly synthesized atomically heavy chemical elements. These “metals” foster gas-cooling and, thus, more star formation — and the protogalaxy is up and running.
So what do we think happened in these early times? The universe was much denser (likely by a factor of more than 1,000) when dark matter began to make the first seeds of galaxies. The first galactic objects were smaller and denser than present-day galaxies, and thus could collapse and pull in gas on timescales of tens, rather than hundreds, of millions of years. Once gas compressed inside such a protogalaxy, stars could begin to form — an especially tricky step that is not fully understood — and then galactic evolution could proceed quickly. For example, very massive stars burn their nuclear fuel in less than 3 to 5 million years and explode as supernovae, spewing out newly synthesized atomically heavy chemical elements. These “metals” foster gas-cooling and, thus, more star formation — and the protogalaxy is up and running.
The dense dark matter needed to promote collapse was produced by disturbances in the early universe. As the post-Big-Bang cosmos cooled, the uneven density of dark matter became important: The densest places were first to resist cosmic expansion and collapse under their own gravity. We do not see these protogalactic seeds today. Over time, most of these early objects merged with their neighbors and became more massive, eventually being incorporated as small parts of the giant galaxies we observe today — like the Milky Way.
— Jay Gallagher, University of Wisconsin-Madison