[step:Rewrite $g(df, \theta)$ as the natural pairing $\langle df, X_\theta\rangle$ via the musical isometry]
The pointwise identity $\theta_p(V) = g_p(X_\theta(p), V)$ defines $X_\theta$ as the metric dual of $\theta$. The metric gradient $\nabla f \in \mathfrak{X}(M)$ is characterised by
\begin{align*}
g_p((\nabla f)_p, W) = df_p(W) \qquad \text{for all } W \in T_p M.
\end{align*}
Two distinct inner products appear in (A): the inner product $g(df, \theta)$ of two $1$-forms (using the metric induced by $g$ on $T^*M$) and the inner product $g(\nabla f, X_\theta)$ of two vector fields (using $g$ itself on $TM$). We claim these are equal:
\begin{align*}
g(df, \theta) = g(\nabla f, X_\theta) = df(X_\theta).
\tag{$\sharp$}
\end{align*}
[claim:The musical isomorphism $\flat : TM \to T^*M$, $V \mapsto g(V, \cdot)$, is a fibrewise isometry between $(TM, g)$ and $(T^*M, g^{-1})$, where $g^{-1}$ denotes the cometric — the inner product on $T^*M$ induced by $g$]
In components, the cometric is given by the matrix inverse $g^{ij}$ of $g_{ij}$; we verify that this coincides with the inner product for which $\flat$ is an isometry, and deduce ($\sharp$).
[proof]
Fix $p \in M$ and choose a $g_p$-orthonormal basis $(e_1, \dots, e_n)$ of $T_p M$ with dual coframe $(\omega^1, \dots, \omega^n)$ on $T_p^* M$, so $\omega^i(e_j) = \delta^i_j$. In this basis $g_{ij} := g_p(e_i, e_j) = \delta_{ij}$, hence the matrix inverse satisfies $g^{ij} = \delta^{ij}$.
The vector dual of $\omega^j$ via the relation $\omega^j(V) = g_p(X_{\omega^j}, V)$ is $X_{\omega^j} = e_j$: indeed, $g_p(e_j, e_k) = \delta_{jk} = \omega^j(e_k)$ for every $k$, and the relation determines $X_{\omega^j}$ uniquely by non-degeneracy of $g_p$. Therefore the inner product on $T_p^*M$ induced by declaring $\flat$ an isometry assigns
\begin{align*}
g_p^{-1}(\omega^i, \omega^j) := g_p(X_{\omega^i}, X_{\omega^j}) = g_p(e_i, e_j) = \delta_{ij} = g^{ij},
\end{align*}
which agrees with the matrix-inverse cometric. By bilinearity in the coframe, the two definitions of $g^{-1}$ coincide on every pair of $1$-forms at $p$, hence globally.
It remains to identify $X_{df}$ with $\nabla f$. Apply the defining relation for the dual vector field with $\theta := df$: for every $V \in T_p M$,
\begin{align*}
df_p(V) = g_p(X_{df}(p), V).
\end{align*}
But the gradient is characterised by $df_p(V) = g_p((\nabla f)_p, V)$ for every $V$. Subtracting, $g_p(X_{df}(p) - (\nabla f)_p, V) = 0$ for every $V$, and non-degeneracy of $g_p$ forces $X_{df} = \nabla f$.
Combining:
\begin{align*}
g(df, \theta) = g^{-1}(df, \theta) = g(X_{df}, X_\theta) = g(\nabla f, X_\theta),
\end{align*}
where the second equality is the isometry property and the third is $X_{df} = \nabla f$. Finally, $g(\nabla f, X_\theta) = df(X_\theta)$ is the gradient definition with $V := X_\theta$. This proves ($\sharp$).
[/proof]
[/claim]
Defining the natural pairing $\langle df, X_\theta\rangle := df(X_\theta) \in C^\infty(M)$, ($\sharp$) reads
\begin{align*}
\langle df, X_\theta \rangle = df(X_\theta) = g(\nabla f, X_\theta) = g(df, \theta).
\end{align*}
Hence (A) reads
\begin{align*}
\int_M \langle df, X_\theta\rangle\,\omega_g = \int_M f \cdot \delta\theta\,\omega_g \qquad \text{for every } f \in C^\infty(M).
\tag{A$'$}
\end{align*}
[/step]