Keep the destination argument in when user switch from user login to register?
I found for Drupal 7 there is no need to override the theme function, just adding a preprocess hook is enough.

/**
 * Add destination param to user tabs if set.
 * Implements HOOK_preprocess_menu_local_task()
 */
function THEME_preprocess_menu_local_task(&amp;$variables) {
    $link = &amp;$variables['element']['#link'];
    // check for $_GET['destination'] because drupal_get_destination() always contains at least the current page
    if ($link['tab_root'] === 'user' &amp;&amp; !empty($_GET['destination'])) {
      $link['localized_options']['query'] = drupal_get_destination();
    }
}


Replace THEME with the name of your theme or module.