Actually, group theory is not a very good example of a theory that has no or few practical applications; see https://en.wikipedia.org/wiki/Group_theory#Physics. In general, you would probably be surprised to learn how much of the modern mathematics (including category theory) has already made its way into theoretical physics and other sciences.
Sub-disciplines of mathematics don't blow up and become cornerstones of education if they don't have practical applications. Analysis, Topology, Algebra, Abstract Algebra, Linear Algebra, Statistics, Geometry... If something doesn't have a major practical use, it'll probably be named after somebody specific and studied in relative obscurity.
Number theory has always had practical use. It used to just be called "Arithmetic", and it didn't become something else until that something else had demonstrated practicality.
The sort of number theory that mathematicians studied for centuries had no practical use until the development of cryptography and computing in the latter half of the 20th century.
That's why Hardy famously used it as his example of mathematics done with no consideration or hope of there ever being a practical application.
I'm talking about education. Mathematicians work on useless stuff all the time. They don't teach it as part of their core curriculum.
Either way, Hardy was wrong. Number theory became relevant because of the work of people who thought it could be. There was hope for a practical application, even if Hardy couldn't see it.