Google has spent three years rebuilding its identity after OpenAI’s meteoric rise jolted the company into action.