Fix inconsistent tab ordering when a user duplicates a tab.
Previosly the correct order of tabs, with the newly duplicated tab being to the right of the original tab, was only shown on that newly duplicated tab. On all other tabs, the newly duplicated tab was shown at the end of the tab list.
Now it all works correctly and consistenly, the newly duplicated tab appears to the right (is the right neighbor of) the original tab on all tabs, is inserted at the correct index.