As the commenters mention, $\lim_{x\to 0+} \big( \frac1{x^2}-\frac1{\tan x} \big)=+\infty$.
l'Hôpital's rule says that (under suitable conditions) $\lim_{x\to a} \frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)}$. In other words, it transforms one problem into another problem; if we can solve the new problem, then the old problem has the same solution.
If we encountered the problem $\lim_{x\to 0+} \frac{\sec^2 x-2x}{x^2\sec^2 x+2x\tan x}$ in the wild, we would see that the numerator tends to $1$ while the denominator tends to $0$ through positive values, and hence the limit is $+\infty$. And we wouldn't worry that the denominator tended to $0$ because we know limits act that way sometimes.
So the same is true if we encounter this problem after an application of l'Hôpital's rule. It's a feature, not a bug!