It is well known that $\beta = (X^{T}X)^{-1}X^{T}Y$ for linear regression. While experimenting with this, I found that $\beta$ (excluding the intercept term) remained the same before and after demeaning $X$. The p-values for coefficients' t-tests also remained the same.
From a statistical sufficiency perspective, a well-known property is that the sample mean is independent of sample variance under normality. This can potentially explain the unchanged p-values. But I am struggling to see the connection to unchanged $\beta$.
Can anyone provide an intuition or proof for this?