A harsh attack by the president drew a quick response from the pontiff, a reminder of his uniquely moral voice.