Some good answers, but I also want to point out that this isn’t actually a universal need.
I think that our social nature, and the way most societies and communities work (particularly in countries that subscribe to exceptionalism) makes them prone to developing these feelings, but they very much are not universal and can even be unleaned.
Also its a nod to our identity, we derive a sense of self worth from those around us. Approval from people who believe what you do makes you feel like youre a part of smth bigger than yourself (look at religion, nationalism etc).