This answer applies to doctoral admissions in the US, and, while not universal, is pretty regular.
First, your successful admission will depend on a weighting of many things. There won't be a standard, published, weighting, but only the general sensibility of the individual faculty members on the admissions committee. Note that most (not all) doctoral admissions is by committee, not by individual PIs/advisors.
The important factors, varying for every candidate and for every committee member, in a rough order of importance, are grades, especially in the field for which you seek admission, letters of recommendation from professors, standardized exams (some places), writing ability in English (some places), research experience (more important if you have a MS, than otherwise), and intangibles. A gap or two in your education can normally be made up as most degree programs are relatively open ended in time.
Among the intangibles might be the place(s) at which you studied, but letter of recommendation from people who know you well would be much more important. A good student from a mid range place might be greatly preferred over a mediocre student from a great institution.
If your previous education is at relatively unknown places then it is likely to be ignored except in a few exceptional cases. If a university already has some experience with others from your place, then their success might help to make a prediction about yours. But it is, I think, much more likely to be a favorable impression made by a good student than the opposite situation.
And note that some great and demanding professors can be found at quite unknown universities. You can learn a lot from them.
The committee needs to make a fairly accurate prediction of the likely success of a candidate. Grades and supportive letters, along with prior research experience are very important. It is much more important what you have done so far and what others think of you, than other things.
Wherever you study, work hard, make a good impression. Stay in contact with professors who support you. But also know that the competition is very fierce.
Also note that most students in the US enter doctoral studies immediately after their bachelors degree. A MS is seldom required and can often be earned along the way.