Neutron stars are the most compact form of matter that we know about; they’re even denser than the nucleus of an atom.
Neutrons, protons and electrons are fermions, meaning they must obey the Pauli exclusion principle. No two neutrons (or protons or electrons) can be in the same quantum mechanical state. If you take ordinary star matter (plasma made of dissociated protons and electrons) and squeeze it, eventually the electrons will nearly overlap in their states. You’d have two electrons with nearly the same energy, spin and location. They cannot overlap though, so this creates a repulsive force that prevents the matter from further compression; this is called the electron degeneracy pressure.
If the compressive force overcomes this pressure, then the electrons can capture on the protons to form neutrons. Neutrons and protons also have degeneracy pressures, but they can be packed much more densely than electrons. This is because their wavelength is shorter. The wavelength of a massive particle is inversely proportional to its mass, and protons and electrons are about 2000 times the mass of electrons. So compressed ordinary matter will inevitably become pure neutrons, simply because this is the most compact form.
A pure electron or pure proton star wouldn’t be as compact because both are charged particles so there would be Coulomb repulsion (this isn’t an issue in ordinary matter since the number of electrons and protons is roughly equal). You’d also need to somehow separate the electrons from the protons, and this isn’t a process that would naturally occur in a collapsing star.