Oxygen and Carbon are the third and fourth most abundance elements in both the universe and the solar system by ATOM FRACTION. Oxygen is the most abundant element in the Earth (again by atom fraction), but Carbon is all the way down at 12.
The reference numbers in MASS FRACTION are:
- Universe - O: 10,400 ppm C: 4,600 ppm
- Solar System - O: 5,920 ppm C: 3,032 ppm
- Earth - O: 297,000 ppm C: 730 ppm
Your question is how to get a planet with equal parts Carbon and Oxygen; or at least a ratio more similar to that seen in the Solar System (roughly 2:1) instead of the ratio seen on the planet Earth (400:1)
How Carbon Stars work
You reference carbon-rich and oxygen-rich star systems beign mutually exclusive. As you can see from the relative abundances, carbon and oxygen are not necessarily exclusive, our own solar system has plenty of both.
But there are specifically carbon rich stars out there. What makes them carbon carbon stars? Well, in a star like the sun, with more oxygen than carbon but relatively cool, most of the carbon in the photosphere is bound with oxygen in the form of carbon monoxide (CO). There is relatively little free carbon, mostly in diatomic form, because there are energetically more favorable combinations to be had with oxygen. However, if there was more carbon than oxygen, all the oxygen would be bound in carbon monoxide and there would be surplus carbon; this would form compounds like diatomic carbon (C$_2$), Methylidine (CH), Cyanogen (CN) and other goodies.
How do carbon stars form? Two main ways (there are surely other ways, but I don't know much about them). One is for a giant star in the Asymptotic Main Branch. At some point after helium fusion into carbon starts, the star starts pulsing back and forth between helium fusion and hydrogen fusion as it expands and contracts. This causes convection that brings carbon to the surface and reveals the spectral bands that allow us to determine that it is a carbon star. Eventually, the pulses start to blow off mass and the star eventually becomes a white dwarf. The blown off mass becomes a planetary nebula.
The other mechanism, is for a star to be a binary twin of a star undergoing the process above. The blown off mass, with all its extra carbon, can get sucked into the binary twin, which now has a surplus of carbon before becoming a helium fusing star.
Generally speaking, either of these two mechanisms is a bad way to go for creating a habitable world. The variable strength of a carbon star would fry/freeze any planet in its orbit, and the exploding plasma ball from a binary twin would be bad for life around the second kind of carbon star.
Why there is little carbon on the Earth
This section is a little less certain, since it was hard to find direct evidence for some of my assertions. In general, the Earth has less carbon because of where it formed in the solar system. The early solar system more or less differentiated itself by its chemical composition. Metallic and silicate materials stayed closer to the sun, volitile liquids and gasses were pushed farther away. The water 'frost line' was about 3 AU from the sun while the proto-planetary disk was still there, so most of the water was farther from the sun than were the Earth coalesced. But most of the oxygen on earth didn't come from water, it came from silicate and metallic oxides, where oxygen was bonded to other common elements like Si, Fe, and Mg.
You may remember that most of the carbon in a star that had more oxygen than carbon was trapped in CO. Well the CO frost line was more like 15-35 AU. So that carbon was much farther away from the Earth than water was. And carbon does not form the same sort of compounds with silicon and metals. So the general gist of it is that carbon was pushed far away from the sun in the proto-planetary nebula, since most of it was in the form of very volitile CO, so most of it is in the gas giants and comets. It is worth noting that, according the paper linked about the CO frost line, the mechanism for the carbon enrichment in the gas giants is still unknown.
How to get a Carbon-rich planet.
So, even if a planet is formed in a carbon-rich system (say from the nebula blown off carbon-rich stars), that planet, if it were near the star, would not be carbon rich itself. So that leaves two possibilities I can think of for making a carbon-rich planet.
- Rogue-ish planet forms in the outer solar system, gets reset into a goldilocks zone orbit by some one-in-a-billion orbital mechanics. It seems hard for an object at the distance of Pluto to get swung into a stable orbit close to a star, but I suppose it could happen. Pluto probably has a lot more carbon that earth does, relatively.
- Unknown mechanism for carbon-enriching the gas giants carbon-enriches an earth-like planet. If we don't know what it is, you can make it up.
Edit: To be clear, the CNO cycle happens in a star's core. The convective zone of a star is cool enough for heavier atoms to retain their electrons, and in the photosphere molecules can and do form. See Asplund, et al., 2005 (section 3) for details on CN, CO, C$_2$, NH, OH and other molecules detected by their emission characteristics in the sun's photosphere.