Some time ago I remember reading an answer by user Bryan to this question. I would really like to re-read that answer, as it has some interesting insights. Could some moderator with a kind soul please post it to an external site like pastebin and share a link here? Thank you.
Below is Bryan's answer. The question is deleted by several high rep. users. I will delete this answer if the community thought that's inappropriate.
Recommending what you should study is easy; in fact, you have covered essentially everything you absolutely need before a PhD program. And I can't think of anything to add (except maybe differential topology which was a senior undergraduate course for me).
However, recommending what in which order is an entirely different matter. And this is the more interesting question.
If you were a computer that could comprehend perfectly the things you read, I would tell you to study these things in order:
- Set Theory (Set-class Theory)
- The Natural Numbers
- Category Theory
- Order Theory
- Group Theory
- The Integers and Number Theory
- Ring Theory
- The Rationals
- Field Theory
- Point-set Topology
- The Real Numbers
- The Complex Numbers
- Linear Algebra
- Measure Theory
- Real Analysis
- Complex Analysis
- Functional Analysis
- Differential Equations
And I would tell you to study Algebraic Topology anywhere after Group Theory, Point-set Topology, and the Real Numbers at your discretion. And I'd recommend Geometry anywhere after Set Theory (preferably after Group theory).
However you're not a machine, and you're not going to master these subjects in this order. Undergraduate curricula do not resemble this list in the least. And if there was a piece of advice I could give you that I wish someone would have told to me before I decided to stick in mathematics, it's that mathematics is a gigantic kaleidoscopic marsh. This is because different branches of mathematics often intertwine (especially true in Abstract Algebra, Number Theory, and Linear Algebra), reach back and support each other (such as Topology and Real Analysis), play off of each other (such as Algebraic Topology), or fundamentally change the game (such as Set Theory). To fully chart one piece of this marsh will require several passes over the same area in different directions.
But even though these branches wind around each other, they each offer their own unique tools and ways of thinking that enable you to traverse the marsh in different ways. This aspect of mathematics can be frustrating as it forces you to sit down and re-wire your brain to think in a different way. This is quite difficult, and, broadly speaking, most people settle into an 'algebraic' or an 'analytic' pattern of thinking.
Since you are only leaving high school without much knowledge of where you're going, you are most likely at a disadvantage. Something should be said about being forced to do homework, take quizzes, and exams that require you to sit down and do the work (unless of course, you are a highly motivated self-learner) so that you are forced to exercise your brain in these different patterns.
But it is well worth it; after this, you can recreationally combine distinct structures from two or more different branches to consider a new compound structure and wonder if the structures interact non-trivially (such as topological groups, measurable topological spaces, or topological vector spaces) which, in turn, leads to new questions very worthy of research.
But you're mostly interested in foundations. This is mostly associated with Set(-class) Theory and Logic. However, you should seriously look into Category Theory. Category Theory is fundamentally different from Set Theory in that Set theory cares more about 'things', but Category Theory cares about 'the stuff between things.' But most interestingly, like Set-class Theory can be used to model Category Theory, Category Theory can be used to model Set-class Theory (namely in the theory of topoi). It's an interesting duality.
I hope my short insights help you in your study.
(Learning what from whence is also an interesting question, but there are already many questions about books on this website. One piece of advice though: no mathematician was ever harmed by having too many books)