Fernando and Pierre-Yves in the comments are right; $R$ has this property (the version where the canonical map is an isomorphism, as YCor says in the comments) iff it is a solid ring, meaning the multiplication map $m : R \otimes_{\mathbb{Z}} R \to R$ is an isomorphism, and no commutativity assumption is needed. To see this really clearly note that we can rewrite the canonical map as
$$\text{id}_A \otimes m \otimes \text{id}_B : A \otimes_R (R \otimes_{\mathbb{Z}} R) \otimes_R B \to A \otimes_R R \otimes_R B.$$
Now the implication $\Rightarrow$ follows by letting $A = B = R$, and the implication $\Leftarrow$ follows by noting that if $m$ is an isomorphism then it's an isomorphism of $(R, R)$-bimodules.
(The idea behind rewriting things this way is that by a variation of the Eilenberg-Watts theorem, the category of functors taking as input a left $R$-module and a right $R$-module, cocontinuous in each variable, and returning as output an abelian group is equivalent to the category of $(R, R)$-bimodules, hence any natural transformation of such functors as in the OP can be analyzed as a bimodule homomorphism, namely the bimodule obtained by substituting $A = B = R$.)