I understand your question as: Which will be more useful for graduate admissions (all other things being equal): a recommendation from a professor at a well-known university, or a recommendation from a professor at a less-known university with whom I have a more personal connection?
There is no one-size-fits-all answer here. The answer depends quite a lot on the degree of the difference (both the difference in reputation between universities, and the difference in how well each professor will end up knowing you personally).
As you have intuited, a recommendation from someone at a well-known institution is worth a lot more than a recommendation from someone at an institution that is not well known. On the other hand, a recommendation that describes your specific talents at mathematics in complimentary detail is worth a lot more than a perfunctory letter that says "Algebraically speaking did a thesis in my institution." (Meanwhile, you know nothing at all about the letter-writing skill of either professor, which is another important variable.)
There is also the impact on your development as a researcher. You would likely benefit from working with someone who takes a close personal interest in you. You would also likely benefit from being at a well-known institution that attracts many talented students and has a very productive research atmosphere.
Your decision will ultimately be a personal one, and we can't give personal advice on Academia.SE. However, since your goal is to go to graduate school abroad, I would suggest the following:
Find out where undergraduate students who work with each professor end up.
You can ask them directly, or talk to their students. In either case, you'd like to know:
- how many of their undergraduate students want to go on to graduate school in mathematics? How many of these actually do?
- for the students that went to graduate school, where did they go? Are these institutions you would consider attending for graduate school?
The "road less traveled" can be great, and rewarding, and all that. But it's also more difficult. If there is a well-traveled path that leads to your desired outcome, get on that path if you can.