The bumpy road to becoming a star
As a nebula collapses, there are forces which resist the collapse. Things like rotation, ionization and heat can overwhelm gravity and keep a given chunk of dust and gas from ever managing to start nuclear fusion and become a star. Those same forces, if the cloud manages to become a star, can help to form planets.
Here’s an article on how our solar system got the infusion of heavy elements needed to form rocky planets like our Earth.
Here’s an article on an early stage collapsing cloud of dust and gas in the Eagle Nebula that has roughly the same amount of material as our solar system.
And here’s an article wherein a protostar was observed to increase in temperature, possibly from the in fall of material from its surrounding disk.