“If your brother sins, go and show him his fault in private; if he listens to you, you have won your brother. But if he does not listen to you, take one or two more with you, so that by the mouth of two or three witnesses every fact may be confirmed. If he refuses to listen to them, tell it to the assembly; and if he refuses to listen even to the assembly, let him be to you as a Gentile and a tax collector." (Matthew 18:15-17)
Jesus said this before the cross. Gentiles are a part of His body now. As I've said elsewhere the word church should be translated "assembly." The Jews had an assembly going back into the old testament. Today the Assembly includes Gentiles thus what Jesus spoke of here was something only for the Jews at the time. How do you treat someone like a gentile when you are one? Gentiles are our brothers in Christ. Jesus also loved & spent time with tax collectors, they were His friends. I don't see abandonment of relationship in view here at all.
Jesus' goal was to have Jews follow & trust in Him so they could be saved by His sacrifice. Sin had real spiritual power before the cross. Jesus wanted the disciples to watch out for each other so sin would not cause them to fall away & prevent them from being saved by His sacrifice on the cross.
Before talking about this Jesus warns that sin could cause them to go to hell, "If your hand or your foot causes you to stumble, cut it off and throw it from you; it is better for you to enter life crippled or lame, than to have two hands or two feet and be cast into the eternal fire." That was only true for someone who did not remain with Christ until the resurrection. Jesus wasn't talking about His post-cross followers losing their salvation. Jesus was talking about Jews not arriving at salvation when it comes at the resurrection because sin distracted them.