Panned for visiting a country he vowed to make a 'pariah,' US president viewed visit as necessary to repair alliances with Arab countries, potentially helping counter Russia, China