Upvote:1
The route you are thinking of isn't a transit in HKG/MO. It's a round-trip Mainland<>HKG/MO. That's a no-no for your purpose, as you will have to show an onward ticket to overseas (coming from PEK).
Note that in PEK, you might or might not transit airside -- if you have to transit between T1/T2 and T3, you will have to enter China, and exit it again.
However, if you have a residence permit from overseas, you can get two weeks, I think. Friend's fiancΓ©e used to do that.
Alternatively, you could return to the Mainland via Taipei. Book HKG-TPE, and TPE-somewhere in the Mainland, under two separate tickets. But you'd need the travel permit for Taipei, too.