To see that $g$ is flat, we need enough pairs of commuting global vector fields. To construct these, let $f(r)\colon[0,\infty)\to[0,1)$ be a monotone function with $f(r)=1-\frac1{\log r}$ for $r\gg 1$. Consider the diffeomorphism $\mathbb R^n\to B^n$ given by $\Phi(x)=f(|x|)\,\frac x{|x|}$. We can map constant (and therefore commuting) vector fields $V$, $W$ on $\mathbb R^n$ to vector fields on $B^n$ that decay sufficiently fast near the boundary of $B^n\subset\mathbb R^n$ so that we can extend them by $0$ to compactly supported vector fields $\bar V$, $\bar W$ on $\mathbb R^n$. By naturality of the Lie bracket, these vector fields still commute.
The same construction in local coordinates gives sufficiently many pairs of commuting vector field of manifolds to conclude that the connection $\nabla$ is flat.
In the comments you ask for global vector fields that are independent almost everywhere. It seems to me that the construction above can be modified to give pairs of commuting vector fields that vanish along the $(n-1)$-skeleton of a smooth triangulation of a manifold $M$, and are linearly independent otherwise.