Where did the CMB come from? What is due to the matter/antimatter annihilation? Or perhaps the radiation released when the electrons decoupled? Where did the CMB originate from? I get that at the beginning of the universe, by the Big Bang theory temperatures and pressures were too high for matter to exist, and even if it did, it would just get annihilated from its antimatter equivalent, thereby releasing electromagnetic radiation (EMR).
However, is this the origin of the CMB? From what I know, before the whole nucleosynthesis and decoupling event, the photons would constantly get scattered and hence the universe was opaque. However, after the temperatures cooled such that neutral atoms could exist, the EMR could propagate out and not get scattered.
However, I read somewhere that it was actually the decoupling event itself which was what originated the CMB. Much like flame tests, or by Bohr's second postulate, when electrons relax into the ground state or just lower energy states, EMR is released. Hence, would the relaxation of these electrons be the source of the CMB?
 A: 
However I read somewhere that it was actually the decoupling event itself which was what originated the CMBR. Much like flame tests, or by Bohr's 2nd postulate, when electrons relax into ground state or just lower energy states, emr is released. Hence, would the relaxation of these electrons be the source of the CMBR?

The CMB has a near perfect blackbody spectrum with a temperature of about 2.7 K. So the source of the CMB cannot be solely from the relaxation of free electrons into hydrogen atom states which would actually lead to a line spectrum. Now I must mention that there are contributions to the CMB due to such interactions (see https://academic.oup.com/mnras/article/371/4/1939/1060928), however they are just perturbations to the background spectrum resulting due to the recombination effect.
A: Once recombination occurred, the black-body radiation, which was in thermal equilibrium with matter (hydrogen plasma), became decoupled from it and was free to propagate. The temperature at which this occurred was about 3000 degrees kelvin.
This means that the CMB is composed of the radiation which existed right before the decoupling i.e., what was flying around inside the 3000 K hydrogen plasma right before the plasma cooled down enough to be quenched.
(Cosmic expansion then stretched out the radiation so much that its spectrum now corresponds to a very cold 2.7 degrees kelvin.)
A: The photon to baryon ratio prior to decoupling is $1.6\times 10^9$ (e.g. here). i.e. There are roughly a billion photons for every proton/electron pair. Therefore the CMB is not produced by recombination of protons and electrons, that process merely facilitated the CMB by making the universe transparent at that time.
However, neither can you say that the CMB photons were produced by matter/anti-matter annihilation, because these photons, produced in the first second after the big bang, had plenty of time to interact with matter prior to recombination - the mean free path of a photon is $\ll$ the age of the universe $\times c$.
The source of the CMB photons is a variety of radiative processes (e.g. bremsstrahlung, photo-recombination [to H atoms and H$^{-}$ ions], elastic and inelastic scattering) that occurred in the mostly ionised plasma shortly before recombination.
