You are confusing the nuclear force
with the strong force in the fundamental forces of elementary particles, one of the four fundamental forces of nature.
When the quarks got bound into the protons and neutrons the strong force was not completely neutralized, there are spill over forces which are still attractive
The nuclear forceis a residual effect of the more fundamental strong force, or strong interaction. The strong interaction is the attractive force that binds the elementary particles called quarks together to form the nucleons (protons and neutrons) themselves. This more powerful force is mediated by particles called gluons. Gluons hold quarks together with a force like that of electric charge, but of far greater strength. Quarks, gluons and their dynamics are mostly confined within nucleons, but residual influences extend slightly beyond nucleon boundaries to give rise to the nuclear force.
....
Sometimes, the nuclear force is called the residual strong force, in contrast to the strong interactions which arise from QCD. This phrasing arose during the 1970s when QCD was being established. Before that time, the strong nuclear force referred to the inter-nucleon potential. After the verification of the quark model, strong interaction has come to mean QCD.
When a nucleus is formed, it is formed because of the attractive spill over forces and some energy is lost( the binding energy) either in photons or in alpha or beta decays before stability is reached .