Friedrich Merz, the front-runner to become Germany’s next chancellor, relied on votes from the far-right AfD to push an anti-migration motion through parliament.