Protective custody can be requested by prisoners who feel or deem themselves to be physically threatened or violated by other inmates.
A "PC unit" is any group of inmates segregated from the general prison population for their safety. Prisoners who feel physically threatened by other inmates can request protective custody at any time. Corrections officers typically keep the inmate in investigative lockup, unable to leave his cell—and therefore out of harm's way—until they rule on the request. Source: How Protective Is Protective Custody?
Child molesters are considered to be legitimate protective custody cases since they are likely to be attacked by other prisoners due to their nature of crime.
However, in small correctional systems, where notoriety is easy to gain and hard to lose, many inmates will never lose their "snitch" label or will not
be able to shed the mantle of a heinous commitment offense, such as one committed against a child. Source: Protective Custody Management in Adult Correctional Facilities
For sex offenders, who occupy the bottom of the prison power hierarchy, the Butner unit was a safe haven in the federal prison system. One child-pornography convict, Markis Revland, told the judge at his civil-commitment hearing that when prisoners discover a sex offender among them “they’ll go to great lengths to stab that person.” Source: The Science of Sex Abuse
There is a well documented instance such as this about the threat to the life of pedophiles in prisons by fellow inmates and also several other instances documented here.
“In time, we began formulating a plan to initiate upon my release,” Drum wrote. “I was going to smuggle poisons to Mr. Mullen so he could silently eliminate sex offenders in prison. I began talking to other prisoners about how to obtain cyanide, how to produce ricin, and how to obtain or produce nicotine sulfate.” Source: The Vigilante of Clallam County
Also media advice such as this and this show the threat perception for pedophiles during their incarceration.
TL;DR: In summary it is true that in some prisons, pedophiles are likely to be sexually assaulted or even killed if they are not placed in protective custody while in other prisons, child molesters are found to be safe and not harmed when kept in an environment designated according to their prison classification. Source: Corrections today