Not a MD. IME this form of social anxiety, while not exclusive to NDs, is indeed common for us.
As to why, the simplest explanation is that it’s a corollary of divergence itself that we internalize early on: in spite of my motive, effort, or attempts at masking, I am just incapable of truly understanding or perhaps even accurately predicting the thoughts and feelings of others, and vice-versa. The self-isolation OOP describes then easily follows, since the best/safest bet is against yourself until proven otherwise.
Personally what disabused me of this behavior was the realization that most people, including NTs, have their own analog of it. That is, many feel like outsiders for various reasons unrelated to ND, and they similarly self-exclude. It’s a useful realization because it lets you cut the knot by giving others what you wanted yourself.
ETA: Specifically, when you focus on others’ inclusion, you (A) create the same for yourself to an equal or greater extent, and (B) over time find it less important that they reciprocate equally than whether you succeed in communicating that they belong. Many things become easier after that.