Calculations of nuclear stability assume the nucleus exists in isolation. In particular, it is not surrounded by a sea of other particles. i.e. It is a low density approximation.
If you do put nuclei in a very high density environment with degenerate fermion gases of electrons and neutrons then you find that the whole calculation of nuclear stability is changed, because the most stable nuclei will be those which minimise the energy density of the entire system. (e.g. see Harrison et al. 1965; Thorne 1966; Shapiro & Teukolsky 1986).
This is the situation that we find in the crusts of neutron stars. At increasing densities, increasingly neutron-rich nuclei become stable, since the beta decay that would occur in a low-density environment, is suppressed by the surrounding dense gas of relativistically degenerate electrons that occupy all the accessible electron energy states (Pethick & Ravenhall 1995; Chamel & Haensel 2008; Rea 2015; Meisel et al. 2018).
At even higher densities, free neutrons "drip" out of the nuclei, become stable and ultimately the dominant component of the gas; their beta decay is suppressed for similar reasons.