Origin of photosynthetic water oxidation at the dawn of life