As it can be seen in [1], there exist commutative rings (with $1$) such that $R_1[x]\cong R_2[x]$ but $R_1$ and $R_2$ are not isomorphic.
If we have one single ring $R$, then it is clear that $$R\hookrightarrow R[x]\twoheadrightarrow R,$$ in which the first arrow is the natural inclusion and the second arrow is evaluation in $0$, is the identity of $R$ and so is an isomorphism.
It seems that one could generalize this to our problem by considering the following morphism $$R_1\hookrightarrow R_1[x]\overset{\sim}{\to}R_2[x]\twoheadrightarrow R_2,$$ in which the middle arrow is our given isomorphism. This is clearly a ring homomorphism and intuitively it should be an isomorphism with $R_2\hookrightarrow R_2[x]\overset{\sim}{\to}R_1[x]\twoheadrightarrow R_1$ as inverse. Why doesn't this work?
Here is a simpler example explaining why your construction does not work.
Consider the ring $R_1 = R_2 = \mathbb Z[t]$. Now, instead of the identity map between $R_1[x] = \mathbb Z[t,x]$ and $R_2[x] = \mathbb Z[t,x]$, look at the map that switches $x$ and $t$: $f(x,t) \mapsto f(t,x)$. This map is an isomorphism, but your composition $$ R_1\hookrightarrow R_1[x]\overset{\sim}{\to}R_2[x]\twoheadrightarrow R_2, $$ is not; it maps $t$ to $0$.
So, even in the case where there is an isomorphism between $R_1$ and $R_2$, your construction does not necessarily give one.