The Rational Root Test proof depends on the polynomial coefs being integers. Let's recall it.
Theorem $ $ If $\,f(x) = f_n x^n + \cdots + f_0\,$ is a polynomial with $\,\color{#c00}{{\rm integer\ coefs}\ \,f_i\in \Bbb Z}\,$ and $\,f(x)\,$ has a rational root $\,x = a/b,\ \color{#0a0}{\gcd(a,b)=1},\,$ then $\,a\mid f_0\,$ and $\,b\mid f_n$
Proof $\ \ 0 = f(a/b)\ \Rightarrow\ 0 = b^n f(a/b)\ =\, f_n\, a^n\! + f_{n-1}\, a^{n-1}b+\cdots+f_1\, ab^{n-1}\! + f_0\, b^n$
Thus $\,\ (\overbrace{f_{n}\, a^{n-1}+f_{n-1}\,a^{n-2}b+\cdots+f_1\, b^{n-1}}^{\large{\rm an\ integer,\ since}\,\ \color{#c00}{f_i\ {\rm are\ integers}}})\,a\,=\, -f_0\, b^n,\ $ hence $\ a\mid b^n f_0\,\color{#0a0}{\Rightarrow}\, a\mid f_0,\, $ since $\,\color{#0a0}{\gcd(a,b)=1},\,\ a\mid bc\,\Rightarrow\,a\mid c,\,$ by Euclid's Lemma, so, by induction, $\,a\mid b^nc\,\color{#0a0}{\Rightarrow}\,a\mid c.$
Notice how the above proof depends crucially on the polynomial coefficients $\,\color{#c00}{f_i\,\ \rm being\ integers},\,$ which implies that the overbraced term is an integer and, hence, that $\,a\mid b^n f_0.\,$ Exactly the same applies to the reversed case, which deduces, symmetrically that $\, b\mid a^n f_n\,\Rightarrow\,b\mid f_n\ $ [or use $\ b^n f(a/b) = f_n\,a^n + ab (\ldots) + f_0\, b^n\,$ for $\,(\ldots) \in \Bbb Z\,$]
Besides identifying where the proof breaks down, there are obvious counterexamples, e.g. $\,x-a/b\,$ has a root $\,a/b\,$ that need not be an integer. Less trivial are quadratic examples
$\quad (x-a/b)\,(x-b/a)\, =\, x^2-(a/b+b/a)\,x + 1\,$ has a root $\,a/b\,$ that need not be $\,\pm1$.
Note also the hypothesis that the rational root is $\color{#0a0}{\rm reduced}$ (in lowest or least terms) is necessary, else e.g. $\, x = 4/6\, [= 2/3]\,$ is a root of $\,3\,x-2\,$ but $\, 6\nmid 3,\, 4\nmid 2.$
The above proof requires only that gcds exist, so it works over any GCD domain, e.g. any UFD (see here for more on this general case).
The Rational Root Test can also be viewed as a special case of Gauss's Lemma for polynomials.
Best Answer
Consider the polynomial $$f(x)=x^2 - 6 x + 5$$
The constant term here is $5$, which is prime.
However, \begin{align}f(5)&=5^2-6\times 5+5\\ &=25-30+5\\ &=0\end{align}
And thus $5$ is a root of the equation.
Therefore, I have disproved your hypothesis through contradiction
For higher degree polynomials, anything of the form $$f(x)=(x\pm p)(x+1)^a(x-1)^b$$ for $p$ prime, and $a,b$ integers will form a contradiction.
Examples include $$x^4 + 8 x^3 + 6 x^2 - 8 x - 7 = (x+7)(x+1)^2(x-1)$$ which has $p=-7$, $a=2$, $b=1$
and $$x^6 - 14 x^5 + 11 x^4 + 28 x^3 - 25 x^2 - 14 x + 13 = (x-13)(x+1)^2(x-1)^3$$ which has $p=13$, $a=2$, $b=3$
To add the constraint that $f(1)\neq f(-1)\neq 0$, then we can choose $$x^3 - 11 x^2 + x - 11=(x-11)(x^2+1)$$
Here we have $f(1)=-20$, $f(-1)=-24$ but $f(11)=0$
As long as the second polynomial is an irreducible one, with a constant of $1$, then this will form a contradiction