Mean-field solution of the statistical dislocation pile-up problem by means of a quantum analogy