Yes, but castration eliminates the production of testosterone, greatly reducing sex drive, or completely eliminating it. It doesn't mean they won't abuse children anymore, but will greatly reduce their desire to in order to fulfill any sexual urge. So to some degree at least, it is prevention.