Can only point you in a vague direction, as I haven’t played with this myself, but I would create a custom controller for the content type and extend the update function, which fires every time you save your content type (or so I believe).
In this function, I’d check whether city and country are set and, if so, set the market like you said in your post.
I’d also do the same for the create function.
You can read more about controllers here: Backend customization - Controllers - Strapi Developer Docs