While I don't disagree with your opening statement in principle, I think your conclusion is faulty. People who are genuine Christians and have the Holy Spirit within are not guaranteed to be free from doctrinal error, and conversely, holding to a doctrinal error is not any proof that the person does not have the Holy Spirit; we are quite capable of going astray. It's better and more consistent with Scripture to say that "the Holy Spirit will not lead people into error."That's right! Those who are guided by God's Spirit will be protected from making seriously wrong interpretations of the BIble! THe seriously wrong doctrine is any doctrines that fail to reveal a correct understanding on the way of salvation as being through accepting Jesus as Lord (God) and Savior of one's life. Christians often sincerely differ on less important doctrines of the Bible, but that doesn't damn them, like a wrong salvation doctrine will. But one's should always do their best to prayerfully interpret all scripture as correctly as they know how, with the Spirit's leading. And when one has a close relationship with God, that helps a lot in understanding the scriptures well. While those who don't have the Spirit's guiding, are prone to doctrinal error and study the scriptures only in their own strength.
1 Cor 2:14
14 But the natural man receiveth not the things of the Spirit of God: for they are foolishness unto him: neither can he know them, because they are spiritually discerned.
KJV
Misunderstanding of this issue causes a lot of finger pointing, condemnation, and judgment. It leads people to think that others who differ on secondary issues must be unsaved. I've seen it frequently on this board, and I think it's arrogant, self-righteous, and sick.