The story of how the ruling came about illustrates the intense effort by the Trump White House to advance its theory that the president has sweeping authority over the entire executive branch, and can direct the actions of employees, including federal prosecutors and immigration judges, who handle sensitive matters of law.