The Pakistani military has wooed Donald Trump, and fallen out with its former Taliban allies, as it looks to wield more influence in the region.