It is correct. If you know a little linear algebra it can be automated as follows
$$\rm \begin{bmatrix} 3 & 7\\ 2 & 5\end{bmatrix} \begin{bmatrix} a\\ 1\end{bmatrix}\, =\, \begin{bmatrix} X\\ \rm Y\end{bmatrix}\ \Rightarrow\ \begin{bmatrix} a\\ \color{#c00}1\end{bmatrix} \, =\, \begin{bmatrix} 5 &\!\!\! -7\\ \color{#0a0}{-2} & \color{#0a0}3\end{bmatrix} \begin{bmatrix}\rm X\\ \rm Y\end{bmatrix}\qquad\quad $$
Hence if $\rm\ d\mid X = 3a\!+\!7,$ and $\rm\, d\mid Y = 2a\!+\!5\ $ then $\rm\ d\mid \color{#0a0}3\,Y\color{#0a0}{-2}\,X = \color{#c00}1. $
Remark $\ $ Using exactlythe same method we can prove more generallly
Theorem $ $ If $\rm\,(x,y)\overset{A}\mapsto (X,Y)\,$ is linear: $\ \rm\gcd(x,y)\mid \gcd(X,Y)\mid \Delta \gcd(x,y),\ \Delta = \det A$
Yours has $\,\Delta = \,3\cdot 5-7\cdot 2 = 1\,$ thus ${\rm \,\gcd(X,Y)=\gcd(x,y)}=\gcd(a,1) = 1.$