Mr. McCain asserted that the Obama administration’s aversion to nation-building had precluded it from providing the kind of training and assistance that would have helped the fledgling Libyan government in Tripoli confront growing security threats from militants.