You're asking the right questions.
Let's look at First Corinthians:
12 For just as the body is one and has many members, and all the members of the body, though many, are one body, so it is with Christ. 13 For by one Spirit we were all baptized into one body — Jews or Greeks, slaves or free — and all were made to drink of one Spirit. 14 For the body does not consist of one member but of many. 15 If the foot should say, "Because I am not a hand, I do not belong to the body," that would not make it any less a part of the body. 16 And if the ear should say, "Because I am not an eye, I do not belong to the body," that would not make it any less a part of the body. 17 If the whole body were an eye, where would the hearing be? If the whole body were hearing, where would the sense of smell be? 18 But as it is, God arranged the members in the body, each one of them, as he chose. 19 If all were a single member, where would the body be? 20 As it is, there are many members, yet one body. 21 The eye cannot say to the hand, "I have no need of you," nor again the head to the feet, "I have no need of you." 22 On the contrary, the members of the body that seem to be weaker are indispensable, 23 and those members of the body that we think less honorable we clothe with greater honor, and our less respectable members are treated with greater respect; 24 whereas our more respectable members do not need this. But God has so arranged the body, giving the greater honor to the inferior member, 25 that there may be no dissension within the body, but the members may have the same care for one another. 26 If one member suffers, all suffer together; if one member is honored, all rejoice together."
(1 Corinthians 12:12-26, RSV2CE)
It is discussing how we are all one Body in the Church. Note how it says "If one member suffers, all suffer together." This implies that when one part of the body sins (and sin is a form of sickness), just like in the human body sickness of one part can affect other parts, so sin in one person affects the whole body.
We can see this explicitly in the Old Testament. Consider the story of Achan, who violated the ban on taking spoils of war (Joshua 7):
7 1 But the sons of Israel broke faith in regard to the devoted things; for Achan the son of Carmi, son of Zabdi, son of Zerah, of the tribe of Judah, took some of the devoted things; and the anger of the Lord burned against the sons of Israel."
(Joshua 7:1, RSV2CE)
7 10 The Lord said to Joshua, "Arise, why have you thus fallen upon your face? 11 Israel has sinned; they have transgressed my covenant which I commanded them; they have taken some of the devoted things; they have stolen, and lied, and put them among their own stuff. 12 Therefore the sons of Israel cannot stand before their enemies; they turn their backs before their enemies, because they have become a thing for destruction. I will be with you no more, unless you destroy the devoted things from among you."
(Joshua 7:10-12, RSV2CE)
So all of Israel was held responsible for the sin of one person, Achan. This theme is repeated in the Old Testament.
Similarly, when one person sins, especially when they gravely sin, the whole Body of Christ, (the new Israel, cf. Galatians 6:16 and Galatians 4:26), becomes sick and ill, and that person needs to be reconciled to the community through a representative of the community, the priest.
So you are right on target.