I already know one answer to the question (which is why the question occurred to me). Here it is:
If $p$ is a prime not equal to $2$ or $5$, then $\frac1p$ has a repeating decimal expression: $$0.d_1d_2\cdots d_k\overline{e_1e_2\cdots e_\ell}$$ where the $d$'s and the $e$'s are digits. Standard techniques (e.g. geometric series) show that $$\frac1p=\frac{d_1d_2\cdots d_k}{10^k}+\frac{e_1e_2\cdots e_\ell}{10^k(10^\ell-1)}=\frac{d_1d_2\cdots d_k\cdot(10^\ell-1)+e_1e_2\cdots e_\ell}{10^k(10^\ell-1)}$$ (Here $d_1d_2\cdots d_k$ and $e_1e_2\cdots e_\ell$ are not products but decimal expansions of integers.)
We can reduce this complicated fraction to $\frac1p$, so the denominator is a multiple of $p$. But $p$ isn't $2$ or $5$, so $10^\ell-1$ is a multiple of $p$.
I have not thought about number theory much, but I imagine this follows from some standard undergraduate number-theorem. Does anyone know one? And does anyone know the history of the proof above? Surely, lots of people teaching Calculus (like me, right now) have noticed this in the course of making tests. Or have I made some mistake?
Your title is actually backwards, what you showed is that there exists $\ell$ such that $p\mid 10^\ell -1$ when $p\ne 2,5$. This is $10^\ell-1$ being divisible by the prime not the prime being divisible by $10^\ell-1$.
Nonetheless, this is true, and you gave an interesting argument for it. In general, this follows from a result known as Fermat's little theorem, which says that if $p\nmid a$, then $p\mid a^{p-1}-1$.
Note on notation: $a\mid b$ is read as $a$ divides $b$ and means that $\frac{b}{a}$ is an integer.
I can't say I'm familiar with the proof you gave or its history though.