Well, the passage about casting a tempting member away could and should (in this case particularly) be interpreted literally.
In the case of a faithful struggling with temptations of the flesh, perhaps there is a point when self-mutilation becomes a lesser sin. Even then, the advice would be to ask God rather than a surgeon for help.
A priest, however, in addition to avoiding sin himself should be in a position to teach others. If he had to resort to self-mutilation to avoid sin, he is no priest material.
The point of celibacy is properly ordered sexuality, not denial of sexuality.
Canon 1 of the Council of Nicea forbids such "violence" by choice and to be retained as a priest. I don't think this canon has been overturned. Apparently, it must have been practiced for it to be specifically addressed in the very first canon.
"To those who can..."
Regards