Who that Wirtinger's inequality does not hold when $a>\pi$?
Your solution is fine but you need to adjust your example because the case when $\pi < a < \sqrt{10}$ is not clear.
Consider the function $u(x) = \sin{\frac{\pi}{a}x}$, now we find
\begin{align*} I[u] &=\int_0^a \left( \frac{\pi^2}{a^2} \cos(\frac{\pi}{a}x)^2 - \sin(\frac{\pi}{a}x)^2\right) dx= \frac{\pi^2-a^2}{2a}. \end{align*}
Thus we have $I[u] <0$ when $a > \pi$.