The president has railed against America’s “endless wars.” But he’s found a style of attack that he likes.