I think you will find that the space is a $\mathbb Q[x]/x^m$$\mathbb Q[x]/(x^m-1)$, which is a product of fields, including $\mathbb Q(\xi)$, where $\xi$ is a primitive $m$th root of unit. Thus it decomposes as a sum of vector spaces over different fields. There is no reason that $\mathbb Q(\xi)$ should be the only field, and thus no reason why $g$ should be a multiple of $\phi(m)$ - and indeed, we can easily construct examples where it is not. I hope the examples you found used square brackets instead of round ones!