Alphabet’s Class A stock rose 38% in the third quarter as Google’s Gemini and cloud-computing businesses took off, defying doubters.