That's simply how arithmetic works. When composing partial functions, the domain of the composite $f \circ g$ is the subset of the domain of $g$ whose image lies in the domain of $f$.
The domain of (real number) division is all pairs of real numbers whose denominator is zero. Therefore, the domain of
$ f(x) = \frac{x-1}{x-1} $
is the set of all numbers $a$ that satisfy:
- $a$ is in the domain of the numerator $x-1$
- $a-1$ is a real number
- $a$ is in the domain of the denominator $x-1$
- $a-1$ is a nonzero real number
And so $1$ is not in the domain of $f(x)$. If $x$ is a variable whose domain is all real numbers, then one can straightforwardly determine that the domain of $f(x)$ is the set of all real numbers other than $1$.
Thus, the restriction of $f(x)$ to any subset of $\mathbb{R} \setminus \{1\}$ is a total function.
As an aside, this all comes down to the fact division is the division of real numbers. There are other settings -- and division operations suitable to such settings -- in which such a $f(x)$ would be equal to 1.