@Veravdn:
Firstly your terminology is wrong. You don't apply for work permit in consulate, you apply for work visa.
Work permit you get after you come to China.
But even before you get to apply for work visa, the employer must create a "work permit notice" for you.
They input data for this online and then print and stamp a paper, which they e/mail to you so you can apply for work visa with it.
The "work permit notice" that is required as attachment to work visa application, includes information about which country you will apply for work visa. It don't remember if it shows in the paper, but the information is stored in system, and consulate staff can check it from there.
I know, because I did all that paperwork as employer to myself earlier this year, so I got to know both the employer and employee parts.
The official policy is that you will then need to apply for work visa in the specific country that is mentioned in your "work permit notice".
Now, some consulates may not follow this policy to the letter (especially in the past when this electronic system didn't exist), but it also means that they can change their own implementation on a whim.
If you indeed want to apply for work visa in HK or Thailand, then you should inform this to your employer in advance, and have them input this to the system.
I suspect that if that part is done by the book, then (non)residence in such a third country is not a major issue.