Note $\ $ There seems to be varying interpretations of the question. I read it as asking that if we somehow find a factorization $\rm\:f=(x−a)\:g\:$ for $\rm\:g\in \hat K[x]\:$ over some extension of the coefficient ring $\rm\:\hat K\supset K,\:$ then does this necessarily yield a factorization over $\rm K,\:$ i.e. is $\rm\:g\in K[x]$? Some readers interpreted the question more simply as: must there exist $\rm\:g\in K[x],\:$ vs. $\rm\:g\in \hat K[x]\: \Rightarrow\: g\in K[x].$
Hint $\ $ It follows from the uniqueness of the quotient (and remainder) in the division algorithm (which is the same in $\rm\:K[x]\:$ and $\rm\:\bar K[x],\:$ using the polynomial degree as the Euclidean valuation). Thus since dividing $\rm\:f\:$ by $\rm\:x-a\:$ in $\rm\:\bar K[x]\:$ leaves remainder $0$, by uniqueness, the remainder must also be $0$ in $\rm K[x]\:,\:$ i.e. $\rm\:x-a\ |\ f\ $ in $\rm \bar K[x]\:$ $\:\Rightarrow\:$ $\rm\:x-a\ |\ f\ $ in $\rm K[x]\:.\:$
This is but one of many examples of the power of uniqueness theorems for proving equalities.