> So a free neutron will decay into a proton and an electron. This already confuses me because the only difference between the nucleons is an up quark (uud vs udd) and an electron an a lepton is a fundamental particle
Conversion between different Quarks are mediated ny the weak force.
The associated particles of the weak force are three bosons: W+, W- , and Z0. (Positively, negatively and neutrally charged).
To convert a neutron into a proton, you convert an up into a down quark.
This is done by emitting a W-, carrying away the negative charge. The W- then decays into an electron and an anti-electron neutrino.
As noted by parent commenter, the same process can and does happen in reverse, just not for free protons. It happens in Proton rich nuclei and for some is there predominant decay channel, see an table of nuclides:
https://en.m.wikipedia.org/wiki/Table_of_nuclides
The nuclides above the stable line are Proton rich and thus decay by either electron capture or positron emission.