I think it depends on the context. If I happen to run into another foreigner in an out-of-the-way place I think the situation might warrant a subtle greeting or head nod or something, assuming we both have the mood for that. Maybe even a conversation, if we’re trapped together on a train or whatever. But if I spot another foreigner in the street in Taipei, which happens often, meh, who cares?
I always find it a bit odd when someone goes out of their way to introduce me to another British person on the assumption we’d just love to talk to one another. We both voluntarily left the place containing sixty-odd million of us.
China was different though, given the lack of foreigners where I lived. The local attitude of everyone in the world being either “Chinese” or “not Chinese” seemed to rub off on us foreigners too, with the consequence that any time I passed a white, black, or anyway not Chinese looking person we’d say hello, maybe even chat for a bit. I have a vivid memory of a Middle Eastern guy driving by me on a scooter wearing a thawb or whatever it’s called, smiling, waving, and shouting “ni hao, salaam alaikum”, with the only thing we have in common being that we’re both not Chinese. I always found it a bit bizarre.