How did the Gentiles get the Holy Spirit before having their sins remitted in water baptism?
I appreciate your asking me this question because it prompted me for the Lord's direction.
A human being can receive God' Holy Spirit while their sins are still present in the body. This is confirmed by the record of Zacharias being filled, and his son John the Baptist from his mother's womb. (Luke 1:15, 67)
God directed my attention to 1 Thessalonians:
"And the very God of peace sanctify you wholly; and I pray God your whole spirit and soul and body
be preserved blameless unto the coming of our Lord Jesus Christ." 1 Thess 5:23
The scripture indicates that the spirit and soul and body are separate parts of a human being. And as such, the spirit can be blameless while the soul and body are not, etc. In considering this it is easy to see that the three components of a man are addressed separately in the spiritual rebirth experience. The soul in repentance, the body through water baptism in Jesus' name, and the spirit by being infiltrated by God's Spirit.
Lastly, it clear that without the sacrifice of our Lord and Savior Jesus Christ the spiritual rebirth referenced above would not have been made available to man at all. It is only by the grace of God that man is given a way to access, through obedience to God's commands, forgiveness for their personal sins and receive the resurrection power of the Holy Spirit of God.