I want to emphasize a point that was made in some comments and as a secondary point in some answers. The question asks about going to a "2nd tier" program for one semester, then applying immediately to a "top 20" math PhD program. Ignoring any ethical concerns:
Attending a master's or PhD program for one semester does not seem likely to strengthen your vita very much when you apply to top PhD programs.
Top 20 math PhD programs are extremely selective. While it might be possible to overcome a poor undergraduate record and earn admission to these programs, it is likely to take more than one semester of classes. By the time you apply, in the fall of your first year at the new program, the professors there will have known you for about 4 months. There is not really enough time to earn the kind of recommendation letter you are looking for, if you want to not only attend a top 20 program but do so after a poor undergraduate record. Moreover, you will have, at best, one new set of grades from the new program (from that fall semester).
It seems to me that, if you want to end up at a top-20 PhD program, a more viable plan may be apply to the best master's program that you can get into - perhaps even at a top-20 program, if they accept students directly into a master's program - and then finish the masters and be absolutely excellent while you do it. That will give you a longer record of success at the graduate level, and time to develop very strong letters of recommendation.