President Trump unexpectedly announced the resignation of acting Homeland Security Secretary Kevin McAleenan late Friday — days after the top official lamented the “tone” of the administration’s hardline immigration agenda.

The president, who’s already gone through four Homeland Security secretaries...