The former first minister quit Bute House just weeks before Rishi Sunak surprised the country by calling a snap general election in July.