> In my experience with pure math, it was mostly solitary.

I disagree, but it might be because I interpret the spirit of the question differently. I would not call an activity involving some collaboration between people at different universities (including email), "solitary." It may not be very socially engaging, but it's categorically not a solitary endeavor. People are working together.

To speak to your examples directly: as you're aware, they're extreme outliers. They're not just extreme because of the level of achievement; they're also nearly heroic in scope for a single person to work on without collaboration. It just doesn't happen much at that level of sophistication and complexity.

More to the point, if you peel back those examples you see quite a lot of non-solitary work. For example, Perelman refused the Fields medal with a declaration that the substantial prior work was just as important for the solution as his own work. He's a pretty big champion of the important of the community aspect of mathematics. Likewise Wiles actually needed collaboration to fix a critical flaw in his original proof of Fermat's Last Theorem.

And that really captures the heart of what I'm getting at, which is what mathematics is "about" by practice and intention. Most mathematicians engage with the research community by attending conferences and collaborating with their peers, even if that collaboration is largely asynchronous. They keep their fingers on the pulse of the academic landscape by talking with other people. In the cases where someone produces noteworthy research on their own, it still exists in a social framework.

A mathematical proof is intrinsically a social endeavor. To prove a theorem is to convince someone else that it must follow from a series of axioms, definitions and other theorems. Sometimes you can do the work on your own, but it won't matter if it's disconnected from the research community, and the easiest way to stay connected to the research community is through collaboration.

If no one else in the world agrees with your proof, your proof is meaningless (as an example, see the controversy around Mochizuki's Inter-universal Teichmüller theory). This is what peer review is for. Moreover if you construct a new mathematical theory, it's only meaningful insofar as it builds upon existing work developed by other researchers. The choice of axioms and definitions must be interesting and significant within the context of an existing body of work.

This is one of the reasons you so rarely see nontrivial research produced by isolation. It's (approximately) a myth, and instances of it happening receive outsized attention precisely because they're extraordinarily rare and unconventional. In reality, it's usually not a good sign for a researcher to work on something in solitude. In most cases it coincides with the stagnation of a mathematician's career, not the glorious unveiling of a solution to a decades-old open problem or a grand new theory.

I can see why the idea that mathematics is a solitary endeavor (or suited to solitary work) is an attractive one, because the most visible parts of it (writing papers, solving problems) can be done alone. But it's usually very inadvisable to go it alone in learning or practicing mathematics.