You are mixing up two eras in cosmology.
Before freeze out
At young age the universe was incredibly hot such that reactions (i.e. $A\rightarrow B+C$) were indeed in thermal equilibrium since $kT >> m_A, m_B, m_C$ there was no preferred direction for this reaction to move into !
The result is that the number densities of the particles are determined by a thermal distribution:
$$F(\vec{p})d\vec{p} = 4\pi g \frac{p^2 dp}{\exp(\frac{E-\mu}{T})\pm1} $$
With the +(-) sign for fermions (bosons). From this we get that the number densities before freeze-out were given by:
$$n(T) = \int dp F(p) \sim \begin{cases}T^3\ for\ the\ ultrarelativistic particles\ p>>m \\\exp(-m/T)\ if\ m>>p \end{cases}$$
Those are the relations that you mentioned.
After freeze out
As time passes and the universe cools there will be a point a which particles are no longer able to maintain this thermal equilibrium since $A\rightarrow B+C$ wil drop out of equilibrium !$(let's say $m(B)+m(C) < m(A)$ such that A will decay.
At this point the relations are no longer valid since there will be less A particles as expected. And more B,C type particles.
This is depicted in the figure below. At early times T is high and the number densities are given by the formulas above, this is depicted by the solid black line. As T drops we observe that the effective particle densities are higher than those expected from the equilibrium calculations (i.e. B or C type particles in our above example).
Note that the final density depends on the crossection of the decay, this is sensible since a higher crossection means that the reaction will remain in equilibrium for longer such that it will follow the full curve for longer.
I hope this helped ? :)
