Oh my, I do sympathize with what you're going through. A great many gifted children go through something similar, I know that doesn't solve anything nor make you feel any better, just know your family isn't alone in that.
Most kids find that it gets better as they get older. The activities they become involved in by choice often help that. Our first insight into that was when our boys started into the music program, a few more kids of the same mindset that they saw on a regular basis, then science club, honors classes, National Honors Society, National Science Honors Society, etc. As kids of like mind get older, they tend to pool into activities / clubs where others of like mind and interests are.
Perhaps the biggest change came when our eldest DS was a Junior in HS. By then it seems kids get more comfortable in their own skin, develop some maturity and appreciation for people of all kinds of mindsets and preferences, not everyone does mind you but enough so that he felt he was accepted and appreciated among a reasonable amount of his peer group.
I think you'll find that just as you have to work hard to ensure you gifted kids are kept challenged and have opportunities for advanced learning, you'll have to do the same socially, going to extra lengths to find activities where those of like mind and interests gather. If you're a religious family, you'll probably find your kids are appreciated for who they are there. As I've mentioned in another thread, the local gaming store was also a great peer group for our kids with a great many kids of like mind, so much so that they accepted each other's quirks and even celebrated them.
Gifted kids often don't have great numbers of friends, instead they often have one or two close friends of like mind, it's important that as a parent you make every effort to help your child to get plenty of time with those one or two kids who they may become close to until such a time as their peer group matures and accepts and appreciates them for who they are.