I wonder if electrons were first (at an early stage of the cosmos) embedded into neutrons, making it easier to understand why they would fit so well with protons later, or if the genesis of electrons and protons are seen as two parallel but independent evolutions.
Electrons came first. In the early universe, during the so-called electroweak epoch, the temperature was so high that large numbers of heavy particles (W, Z, and Higgs bosons, for instance) were created. Once the temperature cooled down enough, all of these bosons decayed into quarks and leptons (electrons, muons, and tau particles).
At this point, during the so-called quark epoch, the universe was still too hot for protons and neutrons to form- instead the universe was filled with a quark-gluon plasma, which consisted of quarks, gluons, and leptons. It wasn't until later that the universe cooled down enough to allow for protons and neutrons to form.
Neutrons do not contain electrons. Electrons aren't really "captured" by protons in the usual sense of the word. The electron is converted to a neutrino via the weak process, while the proton is converted to a neutron. The same interaction occurs between quarks and electrons, such as in the process $\rm eu\to\nu_ed$.
This doesn't mean that the neutron contains an electron. Indeed, the neutron is perfectly happy to capture a positron and turn back into a proton, and this doesn't mean the proton contains a positron.
This is a common guess that has actually been considered before, and one may be led to it by thinking of beta decay and electron capture: in particular, in certain radioactive nuclei, the nucleus will try to stabilize itself by converting a neutron into a proton, and when this happens, an electron comes out to balance the newly-formed positive charge on the proton. This is beta decay. Moreover, the neutron, as a free particle, will actually do this on its own with a mean ($e$-folding) life of around 881.5 s (corresponding to a half-life of 611.1 s, or a bit over ten minutes): it pops out an electron in just the same fashion. Even more, the neutron has more mass than the proton, making this process look all the more suggestive of the idea that an electron is somehow contained inside, or part of, a neutron and it pops off during these processes. Even better, to top it all off, there is this process called "electron capture" in which an unstable nucleus in an atom tries to stabilize itself by "stealing" an orbital electron, and when it does so it combines with a proton to turn it into a neutron, and though it's "accepting" its "missing" component.
However, alas, this does not work. For one, there is another kind of beta decay in which a proton turns to a neutron in some nuclei through giving off a positron, which would lead to the contradictory conclusion that the proton could be formed by a neutron and positron. Though in terms of mass, this doesn't work, and hence protons do not decay on their own - at least through this process - because it wouldn't conserve energy, so you could say that "favors" the electron as being a "constituent" of neutrons for which protons are the "base" particle.
The actual refutation is more complicated and consists of doing high-energy accelerator experiments that probe the structure of protons and neutrons and reveal them both to be composed of three much smaller and lighter particles each that are held together by phenomenally strong, unrelenting forces: these particles are called "quarks", and there are two kinds that make up the proton and neutron, called "up" and "down". A proton is found to contain two up quarks and one down quark, while the neutron contains one up quark and two down quarks, but no electrons or positrons are in either. (And when I say "phenomenally strong", what that means is that in fact, physically, these forces are macroscopic and very much so in magnitude: the bonding force has a literal strength of 10 kN, about the weight of a CAR holding together EVERY single proton and neutron in the Universe!)
The decay processes just mentioned, then, are now understood to occur as the result of a process called the "weak interaction" (which is sometimes called a "force", but it doesn't actually force things around as much as it changes them) which converts between up and down quarks and which can also eat electrons in the process. When the neutron converts to a proton, the weak interaction converts one down quark to an up quark and it creates an electron in the process, and the electron-capture process destroys an electron.
Insofar as the formation of the Universe - well, the answer goes that at an extremely early stage during the Big Bang, a very tiny fraction of a second after the initial singularity, the Universe was so dense and hot that, in fact, it was a "soup" of the quarks just mentioned, called a "quark-gluon plasma" ("gluons" are what produce the forces holding the quarks). As this plasma expanded and cooled with the rapid expansion of the Universe, protons and neutrons precipitated from it as the only stable particles possible, and any neutrons not caught by protons to form deuterium nuclei would then, with their customary almost nine hundred-second mean life would decay to more protons, and electrons. Electrons that did not form by neutron decays formed at the same time as the quarks, as they both condensed from pure radiant energy.