Let $n$ be any integer and $q$ a prime number. Let $m$ be the multiplicative order of $n=a$ $\pmod q$. We want to show that for each prime $p$ dividing $n$, $p^m = 1 \pmod q$. Theorem:
Let $n$ be any integer and $m$ the multiplicative order of $n=a \pmod q$. If there is an integer $b$ such that $b^{n-1}=1\pmod n$ and $\gcd(b^{((n^m-1)/q}-1,n)=n$, then for each prime $p$ dividing $n$, $p^m = 1 \pmod q$.
Any ideas on how to prove this theorem?
Let $n=4$, $q=5$, and pick $p=2|4$. Then $4^2\equiv(-1)^2\equiv 1(\mod5)$, so $m=2$. But $2^2\equiv4\not\equiv1(\mod5)$; hence your claim is false.