what about verses 21 and 22 which Jesus spoke right after this . . .?
... Then came Peter to him, and said, Lord, how oft shall my brother sin against me, and I forgive him? till seven times? .....
... Jesus saith unto him, I say not unto thee, Until seven times: but, Until seventy times seven.
As we can see from the context and reading before and after, Verse 17 is not takling about alienating a brother or sister because he or she will not accept the doctrines of a church.
I’m sorry, but I can’t make any sense of your interpretation of the verses.
When Jesus says, “if he won’t listen to the church, treat him as a heathen or publican,” I assume this to mean:
1) Jesus is speaking about the Church that He founded.
2) This is the Church that “the gates of hell will not prevail against,” meaning that it will not pass away. It must still exist.
3) Jesus’ earthly Church is visible and identifiable as His (otherwise we could not find it, making His divine command nonsensical).
4) Jesus’ command is not time-limited. It is still in force.
5) If someone professes to belong to Christ, yet does not listen Christ’s Church, then we should regard him as a pagan or non-believer.
The only remaining logical question is, Which Church existing today is Christ’s Church. The answer only requires an examination of history.