My ex-H had problems like that. He was a nice person basically & he had a very high IQ but he was only smart in some areas & he had an attitude issue that would come across at times like he thought he was smarter than other people. He didn't think there was anything wrong with his humor....he would say something that many times was a sarcastic comment & he would laugh at himself though no one else was laughing he never noticed because he was laughing. He was good at doing nice things for people because it was the right thing to do, but there was never any emotional connection with the doing of those things.
He never had any friends after the high school guys he had been somewhat friends with but he was more friends with them then they were with him. I hadn't really thought much about it until after I left (stuck in the marriage for 33 years)....but the only friend/acquaintances we had in our marriage were those people that I connected with. It wasn't until last year about 7 years after I left him that I was reading through a book on symptoms of Asperger's & it described 100 % of everything that I was dealing with including his picky eating.
I couldn't figure out how someone who was a nice person could come across making me feel like I was in an abusive marriage. There were times when I would say something to him & he would look at me like I was talking in a foreign language so I would try to use different words to try to get through to him.....I started to think after so many years that it was me, but other people understood me. Many times when I asked him why he did something I would either get the comment "I don't know" or he would totally ignore me.
When he would get into conversations with others, he was pretty much in his own world with his own thoughts & he actually had a difficult time communicating with other people but he wasn't aware of the problem. He thought nothing of making a comment that had nothing to do with the conversation that was being discussed & when asked about it later, he commented to me that he didn't know anything about what was being discussed, so he commented about the weather

but didn't see anything odd about what he did himself or even when I pointed it out.
There can be so many things that can cause the issues you describe....might be good to read about Asperger's & maybe take an online test to see if there is a possibility. If you have a therapist, you might want to discuss it with your T. & maybe they can even to an analysis for you to help you understand what is causing the concerns you are having.