VIENNA—The acrid smell of tear gas saturated the air as an endless column of people from all corners of the world streamed across the border between Greece and Macedonia in August 2015.

It was there and then that Sebastian Kurz decided Europe’s migration policy had failed. Political leaders, he concluded, would need to seal the continent’s borders or risk being swept away by a populist uprising.

Three...