A theory of dislocation cell formation based on stochastic dislocation dynamics