It's because when you changed it, you effectively isolated the numerator, which does not have any restrictions.
What I mean is, take this as an example (instead of your complicated one lol):
1/(x-1)(x-2)=A/(x-1)+B/(x-2)=[A(x-2)+B(x-1)]/[(x-1)(x-2)]
Now, eliminate the denominator (i.e. equate the numerator)
1=A(x-2)+B(x-1)
This is only possible since they shared the same denominator and hence the same restrictions. The numerator is now made to be independent of the denominator. (Hence x=1, 2 can be substituted into the identity.)