I think I figured it out. There is a setting under Audio window in Edit->Settings. I enabled “Synchronize insert/delete edits with MIDI on track”. Now regenerating pieces of a track keep in sync.