My question is. If the cosmic background radiation is red shifted how would you calculate the wavelength at the time it was emitted ?
When talking of cosmology one needs a model, and the standard model for cosmology at present is the Big Bang Model. This developed fitting observations and taking into account General Relativity ( which includes gravitational redshift.) . In this model the universe started from a small spacetime singularity which is not explorable with the physics we know now and is continuously expanding (with varying rates).
The expansion has been measured by measuring the galactic clusters receding from us and the model has been established. Expanding space leads to a redshift, because the wavelength becomes larger:
The photons that existed at the time of photon decoupling have been propagating ever since, though growing fainter and less energetic, since the expansion of space causes their wavelength to increase over time (and wavelength is inversely proportional to energy according to Planck's relation).
The wavelength at the time it was emitted was from photons with the average energy at the decoupling stage when neutral hydrogen could form, and start the matter stage as we know it, order of electron volts.
It is all consistent, the expansion rate since last decoupling, the temperature/ (wavelength) the CMB is now and what it was at decoupling, which is why the model is successful.