In the previous post, we looked at the universe before atoms existed. It was a hot soup of a few particle species, all constantly interacting with one another.
As the universe expanded, it cooled. And as it cooled, that soup began to change.
At first, particles could still transform into one another easily. Protons and neutrons, in particular, could keep converting back and forth. But this could not last forever. Expansion made the universe thinner and colder, and the reactions gradually became too slow to keep up.
From that point on, the balance between protons and neutrons was no longer able to readjust freely.
What emerged from this loss of equilibrium, and remained relevant for what came later, was a simpler mixture of protons, neutrons, electrons, and light.
Still, no nuclei could yet survive. The universe was full of energetic light, and that light could immediately break apart any small bound state that tried to form.
Only after further cooling did the situation change.
Then, for the first time, protons and neutrons could fuse together. That opened the way for the formation of the first nuclei. Once this became possible, helium nuclei formed quickly. The temperature was already low enough for light nuclei to survive, but still high enough for charged particles to overcome their electric repulsion and fuse. Most of the remaining protons, however, stayed free and would only later become hydrogen by capturing electrons. Heavier nuclei did not form in significant amounts, because the universe was already cooling and thinning out, and the nuclear pathways beyond helium were too inefficient for the process to continue.
That is why the visible universe is still made mostly of hydrogen and helium.
The heavier elements did not appear at this stage. They had to wait for stars.
Everything else came later.