This would be the likely hypothetical order of the evolution of the three:
First, Anaerobic - for the reason that it does not need or make O2.
Second, Photosynthesis - necessitates membranes, creates O2.
Lastly, Aerobic - needs produces from aerobic and photosynthesis.