> If they had no useful purpose, why did we think about them for years?
A lot of mathematics is mostly useless, and probably will be for hundreds of years. Some of it ends up being useful, but it's unlikely that much of math like work on geometric langlands will have any applications whatsoever. Math is a service department and the way people teach math best is to be experts in it. In turn, the best way to do that is to develop new math, at least within the context of academia.
Yes, there is some pure math that is used eventually, but I'd say (as someone who worked in pure math for over a decade) that as the results become more specialized and abstract over time, fewer and fewer of them will ever be used.
Every once in a while you see a news article about some math related to physics or something but that's 1/1000 results, if that. The fact is, most modern math research is likely never to be "used".
That doesn't make it useless because maybe we just want to know, but we have to be realistic here...