Do I need a PhD in mathematics if my goal is to teach at the undergraduate level?
At least in the US, if you want to teach calculus, differential equations, and linear algebra, and are also willing to teach lower-level stuff (e.g., algebra stuff like quadratic equations and trigonometry) you can likely do that at a community college, which means you might not need a PhD. If you really want to teach abstract algebra and real analysis you probably could not do that at a community college, which means you'd probably need a PhD.