Dynamical relaxation of the dark matter to baryon ratio