While reading the book Modern Geometry — Methods and Applications Part I, I have a problem reconciling the definition of isometries with the usual version (an isometry preserves the distance between two points). Quoted from the book, an isometry (or a motion of the given metric) is a transformation preserving the Riemannian metric (Def. 4.1.1., page 24). That is,
$x^i = x^i(z^1, \dots, z^n)$ is called an isometry if $g'_{ij}(z^1, \dots, z^n) = g_{ij}(x^1(z), \dots, x^n(z))$,
where the $g_{ij}$ and $g'_{ij}$ are Riemannian metrics of corresponding coordinates systems.
My problem is, how is the concept of distance connected with that of $g_{ij}$? Assuming that the distance between $x_1 = (x_1^1, \dots, x_1^n)$ and $x_2 = (x_2^1, \dots, x_2^n)$ is defined as
$d(x_1, x_2) = \sqrt{\left< \xi, \xi \right>} = \sqrt{\sum_{i, j} g_{ij}(x_1) \xi^i \xi^j}$,
where $\xi$ is the vector originating at $x_1$ and terminating at $x_2$. Let $z_1, z_2$ be points corresponding to $x_1, x_2$ under an arbitrarily chosen transformation, respectively, and let $\eta = \vec{z_1z_2}$. Then, by the definitions of vector and inner product in this book,
$d(z_1, z_2) = \sqrt{\left< \eta, \eta \right>} = \sqrt{g'_{ij}(z_1) \eta^i \eta^j} = \sqrt{ \left[\frac{\partial x^k}{\partial z^i} g_{kl}\frac{\partial x^l}{\partial z^j}\right]_{z = z_1} \eta^i \eta^j} = \sqrt{g_{ij}(x_1) \xi^i \xi^j} = d(x_1, x_2)$.
This suggests that every transformation is an isometry, which is obviously absurd. Thus, either my assumed definition of distance is false or I have misunderstood the definitions of vectors and inner products. Can anyone point out my fallacy?
*This question is coming out when I am tackling with an exercise stating that every isometry of Euclidean n-space is affine, for which I have known a proof like in page 7~8 of this document. Unfortunately, I am unable to "translate" it into the context of Riemannian metric due to my shortage in concepts of distance.