An important quote from Wikipedia regarding the neutron as a building block:

As late as 1940, it was assumed that the neutron was a combination of a proton and an electron. This would have allowed all atoms to be traced back to just these two building blocks. It was only with the further development of quantum mechanics and nuclear physics that it became clear that electrons could not exist as permanent constituents of the nucleus.

1. Around 1920, Ernest Rutherford proposed the existence of a neutral particle composed of a proton and an electron.

This was plausible at the time because protons and electrons were known, whereas the neutron had not yet been discovered. The idea that atomic nuclei might consist of protons and additional "nuclear electrons" was also widespread for a time. One reason for this was the observation of electrons in beta radiation that appeared to originate from the nucleus.

2. Then came Chadwick's discovery:

In 1932, James Chadwick experimentally discovered the neutron. He demonstrated that the unknown radiation consisted of neutral particles with approximately the mass of a proton.
This allowed the neutron to be treated as an independent nuclear particle. Interestingly, Chadwick himself later explicitly stated in his Nobel lecture that Rutherford's proton-electron hypothesis had initially seemed natural. However, he also explained that such a composition was incompatible with the quantum mechanics of the time and with observed spin and statistical properties.

3. In this process, the electron is an initial particle of the reaction; it does not remain as a constituent within the resulting neutron.

Today, we describe this at the quark level as follows:

The proton is thus effectively transformed into a neutron. 4. This is the crucial difference
It can be contrasted as follows:

→ The electron is captured via the weak interaction, and the quark state of the proton changes. The result is a genuine neutron, but that neutron is not a permanently bound proton-electron system.

This is also precisely the historical reason why the statement can be somewhat misleading: "There are no electrons as permanent constituents of the nucleus" does not mean that an electron can never be involved in a proton-to-neutron conversion. In fact, in electron capture, it is explicitly involved.

And even more interestingly: Rutherford’s historical idea and modern-day electron capture look similar at first glance, yet physically describe two completely different things.