Although I am not Catholic and consider the RCC to be wrong on many issues, I can offer some partial defense of JP II. First, consider that he did the flagellation secretly and in private, so he was clearly not trying to impress mankind. Second, fasting, which is another form of self-denial, has been practiced by Christians of many denominations since the beginning.
On the other hand, the flagellation reminds me of Luther climbing the stairs in Rome on his bloody knees, before he became convinced of justification by faith alone.
The pope, more than likely, practiced a very mild form of self-flagellation during prayer. It is not as extreme as many believe it to be.
Those who try to make a bigger issue out of it are just using it as a pretext to attack the Catholic church. Bigots, all of them.