In answer to OP:
Short version. No, they are not necessary. But they are such an efficient and effective way to develop strength in some of the most fundamental movements in sports or indeed physical activity. So for many or most athletes they are probably going to be a significant component of training.
Longer version. Squats develop maximum strength in knee extension and hip extension- the two most important lower body movements. They also you to get better at staying under a crushing load and not being pulled forward by a heavy load. These movements and abilities just have so many useful applications. The squat is not the only way to train these movements- the deadlift, for example, trains the same movements and abilities. Lunges do, too. But the squat trains the movements over large ROM and allows you to go very heavy, which is a necessity for training maximum strength.
You wouldn't need to squat if you already have adequate strength in the movements I mentioned. You could get by without squatting if you had some strength and injury issues were preventing you from doing the needed squatting needed to develop your strength further.
There are other good lower body exercises. Deadlifts are also great. You are basically trading quite a bit less ROM for more weight and more stimulation of the trunk muscles. I think lunges are an under-rated exercise- good for correcting imbalances, good for helping to transfer strength to sports-specific movement. But squats are just the best all-round, general maximum strength developer.
People always say stuff like "I was doing X and then I switched to Y and I got better" or "it felt amazing", like that should be some kind of surprise, or as if it implies that Y is better than X. The reality is, when you are focusing on one thing you tend to be neglecting others. When you switch to others, you will tend to have a base in what you were doing before, and then you will gain very quickly in the new thing. And so for a while you will just be a better athlete. It's like a linear periodization in running training. You start off doing your aerobic base. Then after a few months you start adding speed work. And boom, your overall speed and running performance improves. No one says "Oh, speed work is obviously better than slow work, I'll never do slow work again". People understand that the total components of performance include aerobic and anaerobic, and when they switch from the base phase, they get a significant increase in performance because they now they are focusing on one of the other components. Also, reducing aerobic training can allow reduction of accumulated fatigue and an increase in performance.
If you are squatting for a sport, and you suddenly switch to lunges or pistols or something, you are likely to have the same experience. First, reduction in accumulated fatigue. Second, performance increases from switching to focus on qualities that are not trained as well through barbell squats, like balance or unilateral knee/hip extension. But the key point is that you got to your total performance level largely because of the squatting. It's probably not the case that you would have gotten there just by doing your unilateral work, or whatever. In the same way as the runner wouldn't have gotten to the same level just by doing speed work.
And that leads on to the final point... when you switch from one activity to a complementary one like this, everything is rosy for a while. That's because the properties you were training before take a while to de-train, while you are rapidly building up the new property. But eventually you may de-train. In the case of switching from barbell squats to pistols, or lunges or something, eventually max strength is likely to decline. Which is why in a proper block periodization you usually don't completely abandon the property you were focusing on before, but also do some "maintenance work". And barbell squats remain one of the best choices for that.