I think that while the professor has a point, that those are just stereotypes, in my academic and work experience, which spanned 4 or so decades, there is more than a little truth to the stereotype. At least with regard to tending to be loners and tending to be socially awkward. I suspect the one leads to the other.
It's not surprising that mathematicians tend to be loners. Math down in the trenches isn't generally cooperative effort. Now and then you come out of the trench and compare/share results with others working similar problems but when you're pushing the pencil, (or these days pounding the keyboard), you're most likely going to be doing it alone.
At University of Maryland, back in the 80s, I decided to pursue a BS in math as well as my engineering degree. Really the difference between engineers and mathematicians was quite stark. Occasionally comically so. There were a few math students who were just flat out weird to the point that conversation with them was very difficult and clearly unwanted (by them).
There was a Mathematics PhD student in the group house I lived one semester. It wasn't uncommon for him to be pacing the hall at 3am talking to himself. His body may have resided on Earth but his mind sure didn't. It was utterly impossible to have a conversation with him.
Now of course that's an extreme. But it's an extreme I never witnessed among engineering or even physics majors.
As an aside, the mathematicians I knew at work, did the same basic job as the engineers or physicists. Here's the problem, solve it. Very occasionally the mathematicians were able to pull something out of their hat that the engineers wouldn't have thought of that made the problem much more workable. The mathematicians tended to be better at hitting the literature and gleaning results needed than the engineers did. On the other hand engineers were much more able to find shortcuts and simplifying assumptions and had an overall "git er done" attitude than the mathematicians.