The Sun is a small main sequence star. It does not produce oxygen via fusion. It can't. The temperature and pressure in the Sun's core are too low. Fusion in the Sun is currently limited to production of helium. This will remain the case for several billion years.
That said, there is oxygen in the Sun, about 1% by mass. This oxygen was produced long ago by other stars at the end stages of their lives. Our Sun is a third generation (or more) star. Most of the Sun is far too hot for those oxygen atoms to combine chemically. One exception is sunspots, relatively cool areas on the Sun's photosphere. (Relatively cool means less than 4500 kelvins, so still quite hot.) Molecules can form at these lowish temperatures, and scientists do see signatures of many different molecules in the light coming from the Sun.
Update, in response to edits to the question
Molecules cannot form inside of a star. The temperatures are just too high. Molecules decompose (split apart) into their constituent parts at high temperatures. The Sun's photosphere is about 5800 kelvins, which is already too hot to sustain very many molecules. Temperature rises rapidly with increasing depth below the photosphere. The Sun's core temperature is about 15 million kelvins (27 million Fahrenheit), and the Sun is a small star. Larger stars have even higher core temperatures. At 15 million kelvins, there aren't even atoms, let alone molecules. There are instead atomic nuclei and electrons. Atoms are stripped of their electrons at those extreme temperatures.
In five to seven billion years, our Sun will have fused all of the hydrogen in the core into helium. That's when our Sun will become a red giant. Even then, it still will not produce oxygen. The first stage a one solar mass star experiences after leaving the main sequence is the red giant phase, where the core is an inert mass of helium surrounded by a shell of fusing hydrogen.
Eventually (after another billion years or so), the temperature of that helium core will rise to the point where the helium starts fusing into carbon, plus a little bit of oxygen via the first step on the alpha ladder. At this point, the Sun will leave the red giant phase and join the horizontal branch of the Hertzsprung–Russell diagram. This is a rather short-lived phase of a star's life. The carbon and oxygen produced by helium fusion quickly (in stellar timeframes) form an inert core. At that point, our sun will become an asymptotic red giant.
The red giant and asymptotic red giant phases are rather messy affairs, wracked by convulsions where the star expels lots of gas. Our Sun will lose about half its mass to such convulsions. Molecules do form when this expelled gas cools. This results in some of the prettiest pictures in astronomy, shown below.