President Trump’s attempt to pressure the leader of Ukraine followed a months-long fight inside the administration that sidelined national security officials and empowered political loyalists — including the president’s personal lawyer, Rudolph W. Giuliani — to exploit the U.S. relationship with Kyiv, current and former U.S. officials said.