Is this identity about the Ricci curvature true? $\newcommand{\tr}{\operatorname{tr}}$
$\newcommand{\M}{\mathcal{M}}$
$\newcommand{\Ric}{\operatorname{Ric}} $
$\newcommand{\div}{\operatorname{div}} $
Let $\M$ be a Riemannian manifold, $\nabla^{T\M}$ is its Levi-Civita connection. Given $X \in \Gamma(T\M)$, we consider $\nabla^{T\M} X$ as a linear map (vector bundle morphism) $T\M \to T\M$. 
Is it true that for all $X,Y \in \Gamma(T\M)$
$$\Ric(Y,X)=\tr (\nabla^{T\M}Y) \cdot \tr(\nabla^{T\M}X)  -\tr ( \nabla^{T\M}Y \circ \nabla^{T\M}X), \tag{1}$$
where $\Ric$ is the Ricci curvature of $\M$.
Motivation: I somehow derived (in a very cumbersome way) the equality
$$\int_{\M} \Ric(Y,X)= \int_{\M} \tr (\nabla^{T\M}Y) \cdot \tr(\nabla^{T\M}X)  -\tr ( \nabla^{T\M}Y \circ \nabla^{T\M}X) , \tag{2}$$
(I assume $\M$ is closed and oriented; the integration is w.r.t the Riemannian volume form of $\M$).
Edit:
As observed by levap, equality $(1)$ is false. Here is a proof of equality $(2)$, based on a few lemmas in my answer:
First note that $\tr (\nabla^{T\M}Y)=\div Y,\tr (\nabla^{T\M}X)=\div X$, so equality $(2)$ is nothing but
$$\int_{\M} \Ric(Y,X)= \int_{\M} \div Y\cdot\div X  -\tr ( \nabla^{T\M}Y \circ \nabla^{T\M}X) . \tag{3}$$
We now turn to analyse both summands of the RHS, up to divergence terms: (since the integral of a divergence is zero, this does not matter for the integral):
The first observation (by Anthony Carapetis) is that
$$ (\mathrm{tr}_{13} \nabla^2 Y)(X) = \mathrm{div}(\nabla_X Y) - \mathrm{tr}(\nabla Y \circ \nabla X). \tag{4}$$
(For a proof, see lemma 2 in my answer).
For the other term, we use the identity $\div(fX)=f\div X+\tr(df \otimes X)$, for $f=\div Y$:
$$\div(\div Y X)=\div Y\div X+\tr\big(d\div Y \otimes X\big). \tag{5}$$ Combining equations $(4),(5)$ we obtain that equality $(3)$ is equivalent to
$$\int_{\M} \Ric(Y,X)= \int_{\M} -\tr\big(d\div Y \otimes X\big)  +(\mathrm{tr}_{13} \nabla^2 Y)(X). \tag{6}$$
Now, we use 
$$ \tr\big(d\div Y \otimes X\big) = (\tr_{23} \nabla^2 Y)(X), \tag{7}$$
(See lemma 3 in my answer)
which implies $(6)$ is equivalent to
$$\int_{\M} \Ric(Y,X)= \int_{\M} (\mathrm{tr}_{13} \nabla^2 Y-\tr_{23} \nabla^2 Y)(X). \tag{8}$$
But, lemma 1 in my answer implies that now the integrands are equal: $$ \Ric(Y,X)=  (\mathrm{tr}_{13} \nabla^2 Y-\tr_{23} \nabla^2 Y)(X).$$
To summarize, we showed the original integrands are the same up to divergence terms so their integrals are equal.
 A: 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$. 
A: 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.$$
