$\def\llg{\langle} \def\rrg{\rangle}$ There is a theorem that says if $|\llg a\rrg|=n$, then for each positive divisor $k$ of $n$, the group $\llg a\rrg$ has exactly one subgroup of order $k$—namely, $\llg a^{n/k}\rrg$.
Assume $\llg a\rrg$ is a cyclic group of order $12$, i.e. $|\llg a\rrg|=12$. Take $k=7$, $$ \begin{align} \llg a^7\rrg &= \{a^7,a^{14},a^{21},a^{28},a^{35},a^{42},a^{49},a^{56},a^{63},a^{70},a^{77},a^{84}\}\\ &=\{a^7,a^2,a^9,a^4,a^{11},a^6,a,a^8,a^3,a^{10},a^5,e\}\\ &=\llg a\rrg \end{align} $$
But $7$ does not divide $12$.
$7$ does not divide $12$, which is why $\langle a \rangle$ has no subgroup of order $k$.
You have shown that $\langle a^7\rangle=\langle a \rangle$, which clearly shows that the order of the group $\langle a^7\rangle$ is not $7$, but is in fact $12$, so this result is entirely consistent with the theorem.
You also made an error. Taking $k=7$ and $n=12$, the expression $$\langle a^{\frac nk}\rangle$$ does not become the expression $$\langle a^7\rangle,$$ but rather the expression
$$\left\langle a^{\frac{12}{7}}\right\rangle$$
which, in the constext of your question, is ill defined, since you only define $a^x$ for integer values of $x$ (and, because $7$ is not a divisor of $12$, $\frac{12}{7}$ is not an integer).