It can be done anytime, as luthiers/repairers replace nuts on finished instruments all the time. However there are advantages to doing it during the build process. Presuming the factory nut is centred and seated properly, it's fine for setting the neck and getting the string alignment right.plus I have a bone nut - which brings me to a question. Do I replace the nut now, or after I build the guitar and get it all aligned and working?
Replacing the nut before you apply any finish means you won't need to touch up the finish afterward. NOTE: it can be done without any damage to the finish, but there is always a risk you may thus requiring a touch up repair to the finish.
Also the replacement nut nut may require a bit of adjustment to its width and length to make it fit, or you may get lucky and it will drop right in. FWIW, best to fit to the nut to the slot than fit the slot to the nut. String slot depth is a discussion for another time.
Whether you choose to set the neck and then apply the finish to the whole guitar, or finish the neck and body separately then set the neck, is a personal choice. It can be done either way.
Making the world a better place; one guitar at a time...