(Luke 4:23)23 Jesus said to them, “Surely you will quote this proverb to me: ‘Physician, heal yourself!’ And you will tell me, ‘Do here in your hometown what we have heard that you did in Capernaum.’”
The proverb seems off topic in that context.
A better context would be the following:
The doctor Jesus has to heal himself since he is the sinner in the eyes of the scribes and pharisees.27 After this, Jesus went out and saw a tax collector by the name of Levi sitting at his tax booth. “Follow me,” Jesus said to him, 28 and Levi got up, left everything and followed him.
29 Then Levi held a great banquet for Jesus at his house, and a large crowd of tax collectors and others were eating with them. 30 But the Pharisees and the teachers of the law who belonged to their sect complained to his disciples, “Why do you eat and drink with tax collectors and sinners?”
31 Jesus answered them, “It is not the healthy who need a doctor, but the sick. 32 I have not come to call the righteous, but sinners to repentance.”
The answer of Jesus has to be therefore, in that episode:
I.e., according to the pharisees, Jesus has to convert the presumed sinners at the his table just as he did in Capernaum with the men of the synagogue.“Surely you will quote this proverb to me: ‘Physician, heal yourself!’ And you will tell me, ‘Do here in your hometown what we have heard that you did in Capernaum.’”
Hence the answer of Jesus:
Thererow what did Jesus do in Capernaum?“It is not the healthy who need a doctor, but the sick. 32 I have not come to call the righteous, but sinners to repentance.”
He didn't exorcize a man possessed by an impure spirit (it was an anti-marcionite interpolation by Mark). Rather, he was very explicit against the law and the prophets.