The answer is affirmative not only in the case of 2 matrices, but also in the case of any number of matrices; in fact, an analogous statement is true for quiver representations (in characteristic 0).

The original question can be restated as follows.

Let $P$ be the space of polynomial functions of 2 $n\times n$ matrices, with the adjoint action of $GL_n$ and the ring of invariants $I.$ Consider the space $\text{Hom}_{GL_n}(M_n,P)$ as an $I$-module. Is it true that it is generated by the products of matrices?

For the case of any number of generic matrices $A_1,\ldots,A_k,$ Procesi proved that over a field $k$ of characteristic 0, $I$ is spanned by the traces of the products of matrices. Formally, consider words in the free monoid with $k$ generators, substitute the generic matrices, and take a trace.

Procesi, C. *The invariant theory of n×n matrices*. Advances in Math. 19 (1976), no. 3, 306–381

The statement follows by adjoining an extra generic matrix $A_0$ and converting an $M_n$-space into a $GL_n$-invariant forming a product with $A_0$ and taking the trace, then undoing the trace of the term in the trace polynomial from Procesi's theorem containing $A_0.$

Here is a vast generalization due to Le Bruyn and Procesi. Given a finite quiver $Q$ and a dimension vector $\alpha,$ consider the corresponding representation space $R(Q,\alpha)$ with the action of the algebraic group $GL(\alpha)$ and the space $P$ of polynomial functions on $R.$ (If the quiver consists of a single vertex with $k$ loops and $\alpha=n$ then the representation space is given by $k$ generic $n\times n$ matrices with the simultaneous conjugation action by $GL_n.$) Then, over a field of characteristic 0, the algebra $I$ of polynomial invariants is spanned by the traces of matrix products over oriented cycles in $Q$ and for any pair of vertices $(i,j)$ of $Q,$ the space $\text{Hom}_{GL(\alpha)}(\text{Hom}_k(V_i,V_j),P)$ is generated as an $I$-module by the products over oriented paths connecting $i$ with $j.$

Lieven Le Bruyn, Claudio Procesi, *Semisimple representations of quivers*.
Trans. Amer. Math. Soc. 317 (1990), no. 2, 585–598