It doesn’t need a squaring term because minimising the sum of squared errors is a property of the arithmetic mean.
Here’s a proof that’s maybe helpful for understanding:
https://data-se.netlify.app/2020/11/18/the-mean-minimizes-the-sum-of-squares/#the-sum-of-the-squared-residuals-is-a-minimum
This property also still applies in multiple dimensions and for the weighted average.