No, it's both.
The purpose of high school is to give you a wide foundation on everything.
The purpose of an undergraduate degree (in math) is to give you a wide foundation (in math).
In a (math) PhD, you are generally hyper-specialized in a very, very narrow area (of math).