There is a sense in which the relation between moduli stacks and classifying spaces can be formalized, at least when we use smooth manifolds as parametrizing objects. (Topological manifolds and PL-manifolds also suffice.)
Start with a stack F of spaces on the site of smooth manifolds, which we think of as the moduli stack of some smoothly parametrized objects.
Define the concordification CF of F as the prestack CF(X) := hocolim_{n∈Δ^op} F(Δ^n×X), where Δ^n is the smooth extended n-simplex, i.e., the smooth manifold R^n, with the appropriate face and degeneracy maps.
(The name concordification comes from the fact that F[X] := π_0(CF(X)) is the set of concordance classes of sections of F over X, where two sections x and y over X are concordant if there is a section z over R×X whose restrictions to 0×X and 1×X are isomorphic to x and y respectively.)
It is a nontrivial result that for any stack F of spaces the prestack CF is actually a stack. (For the much easier case of a stack (sheaf) of sets this is shown in Proposition 2.17 and Proposition A.1 in the cited paper of Madsen and Weiss.)
Furthermore, CF is concordance-invariant: for any manifold X the canonical pullback map F(X)→F(R×X) is a weak equivalence.
For any stack (or prestack) of spaces G one can construct a natural map G(X)→Map(X,CG(pt)). Indeed, consider the functor C(F) := (CF)(pt) from prestacks to spaces. This functor is enriched over spaces, so we have a map Map(X,G)→Map(CX,CG). Here the left Map denotes the mapping space of stacks (which are enriched over spaces) and X denotes the representable stack of X. The right Map is simply a mapping space of spaces. By the (enriched) Yoneda lemma we have Map(X,G)=G(X). Furthermore, CX is simply the (smooth) singular simplicial set of X, i.e., the underlying homotopy type of X. Abusing the notation, we write Map(CX,CG)=Map(X,CG)=Map(X,CG(pt)). Altogether, we have a map G(X)→Map(X,CG(pt)).
An observation that goes back at least to Morel and Voevodsky (see Proposition 3.3.3 in their paper) says that concordance-invariant stacks of spaces on the site of smooth manifolds are precisely locally constant stacks, i.e., the canonical map G(X)→Map(X,G(pt)) is a natural weak equivalence for any concordance-invariant stack of spaces G.
In particular, in our case we get a natural weak equivalence CF(X)→Map(X,CF(pt)). Taking π_0 on both sides we get an isomorphism of sets F[X]→[X,CF(pt)].
In other words, for any (moduli) stack of spaces F the set F[X] of concordance classes of sections of F over X is naturally isomorphic to [X,CF(pt)], where CF(pt) = hocolim_{n∈Δ^op} F(Δ^n). It is natural to call CF(pt) the classifying space of F.
For example, for F(X)=Ω^n_cl(X), the set of closed n-forms on X, we get CF(pt)=K(R,n), the nth Eilenberg—MacLane space of R (this is covered by the result of Madsen and Weiss because F(X) is a set).
If we take F(X) to be (the nerve of) the groupoid of real vector bundles of dimension n over X equipped with a connection (and isomorphisms that preserve connections), then CF(pt)=BO(n), the classifying space of n-dimensional vector bundles (or concordance classes of bundles with connection; two bundles with connection are concordant if and only if they are isomorphic as bundles without connection). Note that we get the same answer if we take vector bundles without connection; the concordification construction does not see any local data such as connections, forms, etc.
If F(X) is the space of bundle (n−1)-gerbes with (or without) connection, then CF(pt)=B^n U(1), the classifying space of bundle (n−1)-gerbes (or concordance classes of bundle (n−1)-gerbes with connection).
One can also apply the concordification functor C to morphisms of stacks, for example, applying C to the Chern—Weil construction recovers Chern classes, etc.