A $d$-dimensional flat real vector bundle $E→M$ is classified by a map $\def\B{{\sf B}}\def\GL{{\rm GL}}M→\B\GL(d)_δ$, where $\GL(d)_δ$ is the orthogonal group equipped with the discrete topology.
Arbitrary vector bundles are classified by maps $M→\B\GL(d)$, where $\GL(d)$ is equipped with its natural topology.
Therefore, the obstruction to the existence of a flat connection on a vector bundle is precisely the obstruction to lifting a given map $M→\B\GL(d)$ along the canonical map $\B\GL(d)_δ→\B\GL(d)$.
The homotopy fiber of the latter map is highly nontrivial, see, for example, the Friedlander–Milnor conjecture and Section 5.1 in Knudson's Homology of Linear Groups.