Actually it is beyond any reasonable doubt that the origin of photosynthesis is much more recent than the origin of life.

The reason is that photosynthesis requires very complex structures for which there exists no plausible way to appear in non-living conditions, but only after a long biological evolution from simpler structures.

Photosynthesis is much more correctly named as "phototrophy" (i.e. feeding with light), because light is not used directly in any synthesis, it only provides energy and in some variants, not in all, it also provides reduced molecules that can be used later in redox reactions (typically the so-called NADPH). The name "photosynthesis" was coined at a time when nobody had any idea about how it worked.

The so-called oxygenic phototrophy a.k.a. oxygenic photosynthesis, where free dioxygen is generated by splitting water, has appeared only once, in the ancestor of blue-green algae a.k.a. cyanobacteria, billions of years after the origin of life and a very long time after the bacteria had evolved into a large number of distinct groups.

The anoxygenic phototrophy a.k.a. anoxygenic photosynthesis, where no oxygen is generated, is still encountered in many groups of bacteria, which instead of water oxidize dihydrogen or carbon monoxide or reduced compounds of sulfur or of iron.

It is possible, but far from certain, that anoxygenic phototrophy already existed in the ancestor of all present bacteria. Even in the not very likely case when this were true, there is no doubt that anoxygenic phototrophy has appeared after a long evolution, like also the current genetic code of the nucleic acids, which is also the result of a long evolution from simpler genetic codes, despite the fact that there are no known survivors from that early time.

The results of the current research leave no doubt that the mechanism that has been used by the earliest forms of life for obtaining energy is the one that is still used in the so-called acetogenic bacteria and acetogenic archaea (a.k.a. homoacetogenic bacteria and archaea). For obtaining energy, these convert dihydrogen and carbon dioxide (or carbon monoxide and water) into acetic acid.

So at the origin of life, the required energy source was free elemental hydrogen a.k.a. dihydrogen (or/and carbon monoxide).

Dihydrogen is also produced today in volcanic gases and in hydrothermal vents and it was produced in greater quantities in the past, when Earth had more hydrogen than today, because a significant part of the hydrogen has been lost in space, as it cannot be retained by the gravity of Earth when it is not combined with heavier elements.

Both in volcanic gases and in hydrothermal vents the origin of dihydrogen is in the reaction of volcanic rocks with water, where the water oxidizes the reduced iron ions (FeII) that come from the interior of the Earth into rust (FeIII).

Because volcanic gases are mainly released during violent eruptions, the more peaceful hydrothermal vents, where gases with high dihydrogen content are released slowly during long times in stable conditions are a more likely place for the origin of life.

Moreover, the hydrothermal vents also release alkaline ions (because of the increase in positive electric charge of the oxidized iron ions, which repels the alkaline ions), which create a gradient of ions in their path towards sea water, which is likely to have been an auxiliary source of energy also since the origin of life. All the present life forms still use ion gradients as intermediates in the energy-transforming processes.

The source of energy is the most important factor for the origin of life. There have been plenty of fantastic theories about the origin of life, which have omitted to provide an explanation for a continuous source of energy, without which no form of life is possible, so there is no doubt that all those theories were wrong.

Free dihydrogen is not produced only at the surface of the crust, like in hydrothermal vents, but it is also produced at great depths, wherever volcanic rocks are infiltrated with water. The acetogenic bacteria and the methanogenic or acetogenic archaea do not need any other source of energy, so they can live there without problems.

While the acetogenic bacteria and the methanogenic or acetogenic archaea need only dihydrogen, besides normal constituents of the rocks, like water and carbon dioxide, so they can live at any depth below the surface of the Earth where the temperature is not too great for life, many of the so-called anaerobic bacteria actually need substances, like sulfate or nitrate or oxidized iron, that are products of oxidation caused by the activity of the phototrophic algae and plants, so even when those anaerobic bacteria live in caves or on the deep sea bottom they are still dependent on Sun's light and on the oxygenic phototrophic organisms. Therefore such anaerobic bacteria are unlikely to live at great depths and their metabolism is not relevant for the origin of life.