the first objects to collapse gravitationally after the big bang might have been globular cluster-size galaxy pieces, with masses around 106 solar masses. suppose you merge two of those together, then merge two larger pieces together, and so on, lego-style, until you reach a milky way mass of about 1012 solar masses.