You do realise that the image only provide a general and therefore oversimplification of the universe timeline.
Not all the galaxies formed together after few hundreds of millions years. Some galaxies formed early, while others formed at later time lines, the same with stars forming at different times of the timeline.
Beside that, before the earliest star formation of stars, after the Big Bang Nucleosynthesis and after the Recombination Epoch, there were no atoms heavier than lithium.
Only hydrogen, deuterium, helium and lithium existed before the earliest generation of stars formed, there were only hydrogen and helium gases, no dusts.
You talk of galaxies and stars forming out of gases and dust. That’s incorrect.
Stars only produce heavier elements through mainly two general types of nucleosynthesis:
- Stellar Nucleosynthesis: this type of nucleosynthesis generally occurred at the stars’ cores, where extreme heat and density of the core will cause hydrogen atoms to fuse and produce elements. What types of heavier elements are fused through nucleosynthesis is dependent on the total masses of stars, so there are number of different types of Stellar Nucleosynthesis. For examples:
- Stars with similar masses as our sun, will produce helium. This type is called Proton-Proton Chain Reaction nucleosynthesis.
- More massive stars could hydrogen to elements in cycle of carbon to nitrogen to oxygen, over and over again. This type is called CNO Cycle.
- There are many more, of which some I don’t really understand.
- Supernova Nucleosynthesis: the energy produced from explosions of massive stars will produce many different heavier elements - not just helium, carbon, nitrogen and oxygen - but also nickel, iron, lead, etc.
My point, is that dust only started appearing when massive stars started dying, in supernova events, hence dust are one of the stuff produced from Supernova Nucleosynthesis.
So to summarize: The first generation of stars formed without any dust, because the Big Bang Nucleosynthesis and Recombination Epoch produce only light atoms from hydrogen to lithium, with no dust.
Only with the next generations of stars were they produced from gases and heavier elements, including dusts.