Conflict with db_set_active and variable_get
I've been reading around, and on db_set_active  API page on d.o the 2 comments on that page mention the problem with caches and multi dbs. 

So I went on to look at variable_get API page and it uses global $conf variable. I did a quick search on google on how to "refresh global variables conf" and got this page on d.o DrupalWebTestCase::refreshVariables(). Basically this function refreshes the global variables like so:

protected function refreshVariables() {
  global $conf;
  cache_clear_all('variables', 'cache_bootstrap');
  $conf = variable_initialize();
}


So I'm guessing (I haven't tried it and I don't have a multisite installation at hand to test it) you just need to utilise the code from the above function and clear the variables cache and re-initialize the variables in your foreach loop. I'm not sure how efficient it is so that's another issue if it's not efficient and slows down your page.

global $conf;
foreach ($multisites as $multisite) { 
  // Not sure if cache_clear_all should be called before or after switching the database. You should test and figure out what's best.
  cache_clear_all('variables', 'cache_bootstrap');
  db_set_active($multisite['db']); //switch context
  // Re-set $conf global variable so when variable_get gets called it uses the updated $conf.
  $conf = variable_initialize();
  $links = language_negotiation_get_switch_links(...,...) // run core-function
  db_set_active(); //switch to default
}


Hope this helps steer you in the right direction. Good luck