When you break the rules (intentionally or not), you're taking a risk. Some people get off unnoticed whereas others learn the hard way. Ask people familiar with the country and its laws before arrival and plan your trip properly.
The sexual relationships is relevant because foreigners in China have a reputation of sleeping with a lot of girls, and this leads to a lot of resentment from many of the Chinese. If they at the airport can so easily see when/where a foreigner stayed at an AirBNB, then you have to wonder what other info these people, as well as the embassy people approving VISAs, can see. They do not need to give a reason for denying entry, so it seems it's only a matter of time before they're provided with even more private info that will most definitely be used against foreigners.
It is entirely the traveler's responsibility to understand the requirements for stay and local laws of a foreign country. Ignorance can only get you so far.
The immigration officer – who has absolute power over entry – neither asked anything unreasonable of him nor made any false accusations. This is despite the reporter technically having broken the law. He got off lightly, since the fine for not registering within 24 hours after arrival can be up to $300.