For each year in which a bull market persists, workers become likelier to retire. But those who leave the workforce now—the ninth year of the longest U.S. bull market—are potentially setting themselves up for a tough stretch that could test their portfolio’s long-term resilience.