There is a simple answer to the mystery.

The water lock, the s-shape, is to keep out the stink of the sewage pipe. That stench is no fun, as anyone whose toilet bowl has been completely dry will testify.

But the flushing of a toilet causes a pistonlike effect down the sewage pipe, leaving a vacuum behind it.

This is supposed to be relieved by a ventilating pipe, which you can often see pointing up above buildings. It also lets out any pressure buildups. BUT, if the ventilation is blocked, the pistonlike function of a flush will suck in air through the water lock of the toilet, thus also pulling some of the water with it. This can either happen when you flush your own bowl, or when someone else in the building flushes.

Shit happens. Clear your ventilation pipe.