Pedro Sánchez, the outgoing Prime Minister, was a symbol of leftist fortitude on the world stage. In his own country, he became an avatar of corrupt complacency.