President Donald Trump seized on the government shutdown this week as an opportunity to reshape the federal workforce and punish detractors.