How does the small angle approximation work for cosine? In newtonian mechanics equation of motion of a simple pendulum:
$$\ddot{\theta}=\frac{g}{l}\sin\theta$$
And then I approximated for small angles $\sin\theta\simeq\theta$ that yields the equation of simple harmonic motion we all know:
$$\ddot{\theta}=\frac{g}{l}\theta$$
Out of curiosity I decided to derive the equation through Lagrangian mechanics to understand the way the small angle approximation works for the lagrangian:
$$L=T-V=\frac{1}{2}ml^2\dot{\theta}^2+mgl\cos\theta$$
Then, I realised the small angles approximation for cosine had to be $\cos\theta\simeq 1-\frac{\theta^2}{2}$ instead of $\cos\theta\simeq1$ so I needed the second order approximation to get the simple harmonic motion equation. With some basic calculus I found out that for small angles the error we get approximating cosine to 1 is way bigger than the error we get approximating sine to the first order and they are of the same order if I approximate cosine to second order and sine to first order (that's reasonable since first order sine expansion is the same as second order expansion). My question is: Why when we derive the equation of a wave on a string (assuming constant tension and small angles, elastic waves, and constant linear density), we neglect the horizontal force acting on an element of string?  I'll write down Newton's second law for a piece of string of mass $\Delta m$:
Let $\tau$ be the tension of the rope.
$$\vec{F}=\Delta m \vec{a}$$

Tensions acting at its ends will have the same magnitudes, so we get:
$$\tau(\cos\theta_2-\cos\theta_1)=\Delta m a_x$$
$$\tau(\sin\theta_2-\sin\theta_1)=\Delta m a_y$$
Without going further with this derivation of D'Alembert equation, I've read some books approximating $\sin\theta\simeq\theta$ and $\cos\theta\simeq1$ (so $a_x\simeq0$). If we were to expand cosine to second order (like I said before), would we also get longitudinal waves? If not, why does this approximation work for this model and not for simple pendulum?
 A: Summary
The reason why the approximation doesn't work in the pendulum case is because you are applying it at the wrong place.
Correct way
You should apply the approximation after you differentiate the Lagrangian when applying the Euler-Lagrange equations. Thus
\begin{align}
\frac{\mathrm d}{\mathrm d t} \left(\frac{\mathrm d \mathcal L}{\mathrm d \dot{\theta}}\right)&=\frac{\mathrm d \mathcal L }{\mathrm d \theta}\\[5pt]
ml^2 \ddot{\theta}&=-mgl \sin\theta
\end{align}
Now you can apply the approximation that $\sin\theta \approx \theta$, thus
$$\ddot{\theta}=-\frac{g}{l}\theta$$
which is what you expected.
Fallacy in your argument
The reason why we need to include the second order ($-\theta^2/2$) while approximating $\cos \theta$ is because we are going to differentiate that expression. And once we differentiate the expression, the second order term becomes a first order term ($-\theta$) and thus it suddenly becomes "important". Excluding it, would give us a useless and wrong solution. But however in the string wave case, we aren't going to use any operation which might turn the second order term into a significant first or zero order term. Thus it makes sense not to include that second order term in the derivation.
Conclusion
Always take all the approximations once you've finished applying all the operations which might involve a change in the order (exponent/powers) of the terms. In fact, you should always use the complete Taylor expansion of any function until you get your final expression. This idea is really important and needs to be kept in mind when treating small quantities (as in your case, $\theta$).
