Square wave phase reset happens when you write to the high byte of the wave period, so if the high byte changes, you get a phase reset.
However, it is also possible to use the frequency sweep function to change the high byte of the wave period, so you can avoid a phase reset on a real NES.
Famitracker might want to implement this trick.