You’re buying stock in a company not a market, and a company doesn’t need to be based in a country to profit from that country.
Plenty of companies listed on foreign exchanges make the majority of their money from the US market etc.
> You’re buying stock in a company not a market
I mean, we're talking about index funds, where you essentially are buying a market.
You can buy "into a market" by investing in a ETF following the MSCI EM or SP500. In any case not sure what's your point about single stock companies in a discussion about market indexes.