For graduate admissions, is it better to attend a well-known undergrad program with advanced coursework or one where I can write a bachelors' thesis? I am currently enrolled in a 4-year mathematics undergraduate program in a university (let's call it A) in South Asia and here are the circumstances:


There are very few math majors in the program. I suffer and feel the lack of peers.
Professors are extremely friendly. They work on harmonic analysis, representation theory, Fourier analysis, analytic number theory, functional analysis, category theory, game theory and C* algebra. However, we don't have people working in commutative algebra, algebraic geometry, algebraic number theory and other areas.
At the end of four years, I can at best get courses in real analysis (in one and several variables), complex analysis, general topology, discrete mathematics, analytic NT, ODE and PDE, linear algebra, groups, rings, fields and other courses from the research interests of my professors.
To get an Honors degree, I'll additionally write a Bachelor's thesis.
There are two other places in our country (Let's call them B) which are really good- their programs are tougher, they offer more grad courses, have the best peer group, etc.,have some of the best researchers in the country, cost much less. To move to B, I will have to sit for an admission test and start afresh.


However, they do not have a provision for Bachelor's thesis and are 3 year programs.

My primary concerns are:


Since I want to apply to the top universities in the US, I feel not getting courses like differential geometry, algebraic geometry, algebraic topology at my current institution A will severely affect my application. But I will write a Bachelor's thesis.
If I move to B, not writing a bachelor's thesis will make my application weaker as I will have no proper independent project or something like that to show my research potential but I will get grad level courses.


Here are two questions:


  
  Should I try moving to B or stay at my current institution, A?
  Am I at a significant disadvantage being at A compared to B?
  


I am willing to provide further details without divulging my id.
If I were you, I would try to move to B based on the assumption that B is better than A and A is probably less recognizable in the US than B schools.

You are right that research potential is an important factor the admission committees of top schools will pay attention to. However, bachelor thesis is not the only way to show that you can do research. You can do research papers with professors' supervision at school B if you want.

I suggest B since you can learn a lot more in B than in A. Building the foundations during undergrad stage is more important than doing research prematurely. 

When you apply graduate schools, you need to provide GPA, GRE/TOEFL scores, recommendation letters and any evidence that you can do research.  One of the first things the admission committee will look at is your transcript to determine if you are competent in math. If you stay in A, all you can show is basic to intermediate level math courses. Given that all other conditions will be equal, i.e. you'll get the same GRE/TOEFL scores, about the same recommendation letters (I am not too sure about that), the only thing you can use to beat other applicants is your very good quality bachelor thesis. But, how can you write a very good thesis without having solid math knowledge?

Thus, I am suggesting B. I do understand how tough is the admission exam in that part of the world. It's bloody. Good luck!