I'm not familiar with entry & exit to China, but I have travelled extensively to another communist country just to the south of there. Over half the time I travel there, they find some "problem" with my (or one of my traveling companion's) VISA, passport, customs declaration, hair color, facial expression... you name it, there always seems to be a "problem".
The cure seems to be a ten dollar bill slipped into the passport. Now before everyone freaks out, THIS IS WHAT THEY EXPECT! You can deal with a bunch of hassles (like the OP did), or you can make the "problem" (whether real or imaginary) go away simply. I have sometimes not played the game out of principle, but in the long run, parting with the $10 is the simple solution.
Now we must have some frequent travelers to China here. Were the Chinese officials just looking for the same palm-greasing, or don't they operate like that there. Obviously, you have to be particularly careful with "accidentally" leaving cash in your passport because in more places than not, it can get you into even MORE trouble - China may very well be in that category.