Loneliness means wanting someone to accompany you but not having it. Loneliness means actively alienating others.
Back to the question, why do philosophers actively alienate others? Rousseau said in "On whether the revival of science and art can make folk customs more simple" that the more people who study philosophy, the farther away they are from society and people, and finally they can't love others.
After that, let's talk about why we should stay away from others. There are many reasons.
First, I don't want to be influenced by secular views (Nietzsche, although he had been focusing on his own research before his death, his unfinished works were taken out by relatives and adapted into Nazi brainwashing works after his death).
Second, I don't want to be disturbed by trifles (there was no breakthrough research after Newton became famous).
Third, advanced ideas are always rejected by society (Copernicus is a bloody example).
In fact, in our society, most people are not friendly to philosophers. Only after they die and their views are confirmed will someone worship them. Although an enlightened society will give philosophers their own foothold, secular influences are constantly eroding their thoughts.