Do trade routes activate between my cities when a road goes through city states or other civilizations' cities?

Regarding passing through another civ or city-states territory:

Trade routes can pass through other civs as long as you have open borders agreement from them. Trade routes do not work through a civ you're in war with, even though technically your units can pass within their borders.

Regarding city-states, it works of you are either friends or allied with them.

Regarding passing through an actual city:

I believe it's precisely the same as the above - your road passing through the actual city shouldn't make a difference, except for saving you money, since cities count as road tiles.