Let $k$ be a field and let $X$ and $Y$ be objects of a category $C$ enriched over $k$-vector spaces. Composition gives us a linear map $\hom(X,Y) \otimes \hom(Y,X) \to \hom(X,X) \oplus \hom(Y,Y)$, that sends an elementary tensor $f\otimes g$ to $(g\circ f, f \circ g)$. Assume that $(id_X,id_Y)$ is in the image of this map. Is it then true that $X$ and $Y$ are isomorphic?
I tried finding a counterexample when $C$ is the category of vector spaces, but couldn't find one. I also tried proving it by taking a sum of elementary tensors in the preimage of $(id_X,id_Y)$ and trying to construct an elementary tensor out of them. I didn't succeed in doing this either, even in the case of a sum of two elementary tensors.
Counterexamples or proofs (maybe with more hypothesis) are much appreciated.
When $\operatorname{char} k=0,$ there are no counterexamples in the category of vector spaces over $k.$ If $X$ and $Y$ are both finite dimensional, then $(g\circ f, f\circ g)$ lands in the vector space $\{(\alpha,\beta)\mid \operatorname{tr} \alpha=\operatorname{tr} \beta\},$ which only includes $(\mathrm{id}_X,\mathrm{id}_Y)$ if $\dim X=\dim Y.$ If one of them is infinite-dimensional, say $\dim Y=\kappa>\dim X$ wlog, then $f\circ g$ lives in the vector space of maps $Y\to Y$ of rank less than $\kappa,$ which does not include $\mathrm{id}_Y.$
However, there are counterexamples in the category of left modules over the first Weyl algebra $R=k[A,B]/(AB-BA-1).$ Take $X=R$ and $Y=R^2.$ Let $M$ be your map, defined on elementary tensors by $M(f\otimes g)=(g\circ f, f\circ g).$ For any $r,s\in R,$ consider the maps $$f_1(x)=(xs,0)$$ $$f_2(x)=(0,xs)$$ $$g_1(x,y)=xr$$ $$g_2(x,y)=yr$$ Then $M(f_1\otimes g_1+f_2\otimes g_2)=(g_1\circ f_1+g_2\circ f_2,f_1\circ g_1+f_2\circ g_2)=(2sr,rs)$ is in the image of $M,$ where I am using the right $R$-module structure on $\operatorname{hom}(X,X)$ and $\operatorname{hom}(Y,Y)$ to allow elements of $R$ to denote right multiplication maps (e.g. $2sr$ means the map $x\mapsto 2xsr$).
Setting $r=1$ and $s=1+AB$ shows that $(2(1+AB),1+AB)$ is in the image of $M.$
Setting $r=B$ and $s=A$ shows that $(2AB,BA)$ is in the image of $M.$
Subtracting and dividing by two shows that $\tfrac12(2(1+AB)-2AB,1+AB-BA)=(1,1)$ is in the image of $M.$ But $R$ is left Noetherian and hence has invariant basis number, which ensures $X$ is not isomorphic to $Y$ as a left $R$-module.