EDIT: I am in the UK, and therefore my answer is relevant to there. Things may be different in the US, although I'll note that others have stated that student graduation rate is a performance metric there as well
I am a bit hesitant to answer this because I guess the answer might put people off making a decision that is the correct decision for them, but honesty is always best, so the answer is yes, it can hurt a supervisor for their students to leave.
Where I am, the % of students who submit a thesis within time limit is a key metric on which an academic is judged. One reason for this is that government funding for PhD programs requires that submissions within time limit are above a certain threshold. This is also the reason that many universities will not initially register a student for a PhD, but will require the students to undergo a confirmation review after a year - if the student is dismissed at this point, it doesn't count against the department, but after this it does.
An academic will probably not suffer too much from a single student not completing in time (although yes, they will lose the right to say "my graduation rate is perfect" on a promotion case or job application). More than one and questions will definitely be asked, and that PI might start to find it more and more difficult to win the right to recruit students.
However, none of this should affect a student's decision as to whether continuing a PhD is right for them or not, and the damage done to a student staying in a programme when it is not right for them massively out-weighs the damage done to the supervisor if they leave.