taking an example
The function $f(x)=\dfrac{x^2-16}{x-4}$ is not defined at $x=4$ but on simplifying it to $x+4$ it gets defined at $x=4$. So does the factorizing and simplification changes the function?
Saying it in different way
Multiplying $x+a$ with $\dfrac{x-n}{x-n}$ (which is basically $1$) makes it undefined at some value $n$.
This means multiplying by 1 changes the function. Is this true? Because the graph of the function will get a hole in it but on other hand we always write $x\cdot 1=x$.