“He also said he was scared, and that in the past, when he has felt he was getting too close to someone, he would pull away.”

this sentence is from "dear abby"

I feel a little awkward about the tense. I am wondering about the tense after "when". I don't understand why present perfect is used.

As long as I know, the tense in Indirect speech should be either changed or the same as Direct speech on condition that the comment is still relevant.

I imagine their conversation this way. please look below.

Direct speech

The man : "when I felt I was getting close to someone in the past, I would pull away."

Because of "in the past", I feel simple past tense should be used.

*Indirect speech *

The writer : "He said when he had felt he was getting to close to someone in the past, he would pull away."

Because his remark isn't relevant anymore, however, I am not completely sure if It is relevant or not I guess the tense should be changed into past perfect, not present perfect.

Am I missing or misunderstanding something? I couldn't find why present perfect is used in any respects. I hope somebody help me.
I don't understand why it was used either... I would say it's wrong. Emotion: surprise Actually, I hope it's wrong.
This is how I would say it:
He said when he felt he was getting to close to someone in the past, he would pull away.

But I am not a native speaker. Emotion: wink
The instincts of both of you are correct.

Remove the has in ... when he has felt ..., and all balance and harmony will be restored! Emotion: smile