Update node creation to unlock at the right time.

For testing, we invoke a test provided callback that can block the
progress of the balance plan and simulate a data race.

See #375.