For AiMesh nodes, they need to be dealt with first. Just upload the new firmware (Stock or Merlin or whatever), let them reboot and remove them from mesh using web GUI. That resets them.
Then I come to the main router where I ssh into router first and pass command hnd-erase nvram and then immediately upload firmware manually using GUI. When firmware update is complete, I am greeted with Welcome screen wizard.
Once I have enabled Ethernet Backhaul for nodes, I add them at the end after the main router has been set up the way I want.
That's my personal way and while it might be right or wrong I don't care. Gets job done without any drama and has worked solidly for me for last 2 years.