I would argue there are two considerations to your question. The level of math that you need for a PhD in economics depends mostly in your interests and fields you would want to work on. Moreover, the kind of math becomes more important than the level by area of research. The second aspect of it, which you might be more concerned with is the signal issue. For that, it might depend on what the departments you would like to apply value. For learning math, community colleges have proven to provide high quality education and accessible. Certain online classes can be taken for free or very reasonable fees. A sophisticated department might properly value that experience, but others might require for example a pre-doctoral program or a pre-PhD masters. I agree that teaching yourself math can be a valuable exercise, not only to learn math, but as preparation for dissertation phase and your life afterwards.