The president has long articulated a moral equivalence between the country’s interests and those of dictatorships.