Primary endosymbiosis and the evolution of light and oxygen sensing in photosynthetic eukaryotes