How much does the reputation of the undergrad institution matter in top 10 graduate schools in Mathematics? I will be starting as a freshman in August 2018 in an undergrad institution. My school does not have the best reputation for mathematics in my country. Although it has a tie-up with another nearby graduate institution, which is the well known to top 10 US graduate program in Mathematics. Some Faculties from it teach courses at my institution. As from there, I do have hopes of getting good LOR's. Because of fewer facilities, many students in my undergrad pursue their honors thesis at a different location. Few of them pursued outside of my country under AMS fellows.

Ph.D. placements at my school include Dartmouth ,Northwestern, Paris, UIUC etc.

I do have the option of taking a gap year and target two other schools A &amp; B.

School A has recently started its undergrad program. Although it is fairly reputed in my country and abroad.
Their placements include Chicago, Ohio State, Wisconsin etc.

School B has the best math undergrad program in my country. It has a stellar reputation in top 10 grad schools in the US and many students are pursuing PhDs in those schools.

I know Harvard or Princeton is beyond my reach, but do schools like Chicago or Berkeley care more about elite undergrad status. Should I take a gap year? Can stellar letters of recommendation and good honor's thesis outweigh undergrad reputation?
Unfortunately, this is not really a trade-off we are qualified to help you with.  There are just too many unquantifiable factors (we don't even know what country you are in!); I generally don't really recommend students putting off the rest of their lives for a year to try something like an entrance exam again.  Even if you can get in, it could be that going A and B will make a big difference, but you can't possibly know that (maybe Chicago had a really bad experience with the last student that came from A; you just can't control this stuff). Who can possibly guess what the general political situation for foreign graduate students in the US will be in a few years?  

So my advice is to start at your current institution, and do the best work you can.  That's what you can control.