$\int \sec^3x dx$ in disguise
From your trig sub $x=\tan\theta$,
\begin{align} \int \sqrt{x^2+1}dx&=\int \sec\theta(\sec^2\theta d\theta) \end{align}
That is, $\sqrt{x^2+1}=\sec\theta$ and $dx=\sec^2\theta d\theta$. The integrand only changed to $sec^3\theta$ after both of these pieces are considered.
Reassuringly, $\sqrt{x^2+1}\ne\sec^3\theta$, because $dx\ne d\theta$.