Is this identity about the Ricci curvature true?
The right hand side is not tensorial in $X,Y$ so you definitely don't have a trivial equality. Consider for example the case $M = \mathbb{R}^n$ with the flat metric. The left hand side is zero but the right hand side is
$$ \operatorname{tr}(dX) \operatorname{tr}(dY) - \operatorname{tr}(dX \circ dY) $$
where we identify the vector fields $X,Y$ on $\mathbb{R}^n$ with smooth maps $X,Y \colon \mathbb{R}^n \rightarrow \mathbb{R}^n$ and then the full covariant derivatives $\nabla X, \nabla Y$ are identified with the differentials $dX, dY$. When $n > 1$, the identity
$$ 0 = \operatorname{tr}(dX) \operatorname{tr}(dY) - \operatorname{tr}(dX \circ dY) $$
is false already for linear vector fields $X,Y$.
I prove a few lemmas, required to establish the integral equality: $\newcommand{\tr}{\operatorname{tr}}$ $\newcommand{\M}{\mathcal{M}}$ $\newcommand{\Ric}{\operatorname{Ric}} $ $\newcommand{\div}{\operatorname{div}} $
Lemma 1:
$$\Ric(X,Y) = (\tr_{13} \nabla^2 Y - \tr_{23} \nabla^2 Y)(X)$$
Proof:
We first note that $$\nabla^2 Y(X,Z)-\nabla^2 Y(Z,X)=(\nabla_X \nabla_Z Y-\nabla_{\nabla_X Z}Y)-(\nabla_Z \nabla_X Y-\nabla_{\nabla_Z X}Y)=$$
$$\nabla_X \nabla_Z Y-\nabla_Z \nabla_X Y-\nabla_{(\nabla_X Z-\nabla_Z X)}Y=\nabla_X \nabla_Z Y-\nabla_Z \nabla_X Y-\nabla_{[X,Z]}Y=R(X,Z)Y.$$
Now,
$$ (\tr_{23} \nabla^2 Y - \tr_{13} \nabla^2 Y)(X)=\sum_i \langle \nabla^2 Y(X,e_i)-\nabla^2 Y(e_i,X),e_i \rangle=\sum_i \langle R(X,e_i)Y,e_i \rangle=$$
$$ -\sum_i \langle R(e_i,X)Y,e_i \rangle=-\Ric (X,Y).$$
Comment: Here is why $$\nabla^2 Y(X,Z)=\nabla_X \nabla_Z Y-\nabla_{\nabla_X Z}Y :\tag{1}$$
By definition, we have $\nabla^2 Y(X,Z):=(\nabla^{T^*M \otimes TM}_X \nabla Y)(Z).$
$$ \nabla^{TM}_X \big((\nabla^{TM} Y)(Z))=(\nabla^{T^*M \otimes TM}_X \nabla Y)(Z)+(\nabla^{TM} Y)(\nabla_X^{TM} Z),$$
which is equivalent to
$$ \nabla^{TM}_X \nabla_Z^{TM} Y= \nabla^2 Y(X,Z)+\nabla_{\nabla_X^{TM} Z}^{TM}Y.$$
Lemma 2: $$(\mathrm{tr}_{13} \nabla^2 Y)(X) = \mathrm{div}(\nabla_X Y) - \mathrm{tr}(\nabla Y \circ \nabla X). $$
Proof:
Using equation $(1)$, we get
$$(\mathrm{tr}_{13} \nabla^2 Y)(X)=\sum_i \langle \nabla^2 Y(e_i,X),e_i \rangle=\sum_i \langle \nabla_{e_i} \nabla_X Y-\nabla_{\nabla_{e_i} X}Y,e_i \rangle=$$
$$ \sum_i \langle \nabla_{e_i} (\nabla_X Y),e_i \rangle-\sum_i \langle \nabla_{\nabla_{e_i} X}Y,e_i \rangle=$$
$$ \mathrm{div}(\nabla_X Y)-\sum_i \langle \nabla Y(\nabla_{e_i} X),e_i \rangle=$$
$$ \mathrm{div}(\nabla_X Y)-\sum_i \langle \nabla Y(\nabla X(e_i)),e_i \rangle=$$
$$ \mathrm{div}(\nabla_X Y)-\sum_i \langle (\nabla Y \circ \nabla X)(e_i),e_i \rangle=\mathrm{div}(\nabla_X Y) - \mathrm{tr}(\nabla Y \circ \nabla X).$$
$\newcommand{\tr}{\operatorname{tr}}$ $\newcommand{\M}{\mathcal{M}}$ $\newcommand{\Ric}{\operatorname{Ric}} $ $\newcommand{\div}{\operatorname{div}} $
Lemma 3:
$$ \tr\big(d\div Y \otimes X\big) = (\tr_{23} \nabla^2 Y)(X).$$
Proof:
Let $p \in M$. Let $e_i$ be a frame induced by normal coordinates centered at $p$. In particular, $e_i(p)$ is an orthonormal basis for $T_pM$, and $\nabla_{e_j} {e_i}=0$.
On the one hand
$$A:=(\tr_{23} \nabla^2 Y)(X)= \sum_i \langle \nabla^2 Y(X,e_i),e_i \rangle=\sum_i \langle \nabla_X \nabla_{e_i} Y-\nabla_{\nabla_X {e_i}}Y,e_i \rangle= \tag{1*}$$
$$ \sum_{ij} X_j \langle \nabla_{e_j} \nabla_{e_i} Y-\nabla_{\nabla_{e_j} {e_i}}Y,e_i \rangle=\sum_{ij} X_j \langle \nabla_{e_j} \nabla_{e_i} Y,e_i \rangle=\sum_j X_ja_j,$$
where
$$ a_j=\sum_i \langle \nabla_{e_j} \nabla_{e_i} Y,e_i \rangle \tag{2*}$$
On the other hand,
$$B:=\tr\big(d\div Y \otimes X\big)=\sum_j \langle (d\div Y)(e_j)X,e_j \rangle=\sum_j \langle b_jX,e_j \rangle=\sum_j b_jX_j, \tag{3*}$$
where
$$ b_j:=(d\div Y)(e_j)=e_j \cdot \div Y=e_j \cdot \sum_i \langle \nabla_{e_i}Y,e_i \rangle=\sum_i e_j \cdot \langle \nabla_{e_i}Y,e_i \rangle \tag{4*}=$$
$$ \sum_i \big( \langle \nabla_{e_j}\nabla_{e_i}Y,e_i \rangle+ \langle \nabla_{e_i}Y,\nabla_{e_j} e_i \rangle \big)=\sum_i \langle \nabla_{e_j}\nabla_{e_i}Y,e_i \rangle=a_j.$$