Rep. Justin Amash of Michigan has emerged as one of the leading Republican critics of the president, using a tool Mr. Trump himself often employsan assertive presence on Twitter to challenge and even taunt the president.