The events that triggered the ouster of South Korea’s president paralyzed state affairs—while delivering an intelligence windfall to the country’s archnemesis.