Jesus also was speaking to Nicodemus (who was noted as being of the sect of Pharisees)
John 3:1 There was a man of the Pharisees, named Nicodemus, a ruler of the Jews
And John himself baptized with water but those of the Pharisees (specifically) rejected being baptized by John as noted here
Luke 7:30 But the Pharisees and lawyers rejected the counsel of God against themselves, being not baptized of him.
So that would be Nicodemus' mindset, rejecting the water baptism of John I would think, because it also says, all the common people heard John, and the publicans and harlots justified God being baptized by John but that the Pharisees specifically rejected the counsel of God against themselves in not being baptized by John.
And Jesus gives an example between a certain two as far as doing the will of God as far as John goes in this and asks these,
Matt 21:31 Whether of them twain did the will of his father?
They say unto him, The first.
Jesus saith unto them, Verily I say unto you, That the publicans and the harlots go into the kingdom of God before you.
The context
Mat 21:32 For John came unto you in the way of righteousness, and ye believed him not: but the publicans and the harlots believed him: and ye, when ye had seen it, repented not afterward, that ye might believe him.
And Jesus, "the righteousness of God" comes out to John to be baptized
Mat 3:13 Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him.
Obviously, we cannot blame John for his initial reaction
Mat 3:14 But John forbad him, saying, I have need to be baptized of thee, and comest thou to me?
And John actually had the Holy Ghost from his mothers womb (Luke 1:15)
Which might beg the question, which baptism would John be in need of if John has the Holy Ghost (More Holy Ghost and or fire or water) Mat 3:11, Luke 7:30?
Mat 3:15 And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.
Jesus to John (in respects to his own water baptism) said, "thus it becometh us to fulfil all righteousness"
And again here this way,
Mat 21:32 For John came unto you in the way of righteousness, and ye believed him not: but the publicans and the harlots believed him: and ye, when ye had seen it, repented not afterward, that ye might believe him.
Since the publicans and harlots are shown as justifying God (and not self) here in this thing
Luke 7:29 And all the people that heard him, and the publicans, justified God, being baptized with the baptism of John.
Whereas to the contrary, the sect of Nicodemus (who come to Jesus by night) rejected the same.
Luke 7:30 But the Pharisees and lawyers rejected the counsel of God against themselves, being not baptized of him.
And its on this point in Matt Jesus says to them here
Matt 21:31 Jesus saith unto them, Verily I say unto you, That the publicans and the harlots go into the kingdom of God before you.
And that was in the context of water and entering the Kingdom even as water is included in the following concerning entering the Kingdom in conversation with a Pharisee.
John 3:5 Jesus answered, Verily, verily, I say unto thee, Except a man be born of water and of the Spirit, he cannot enter into the kingdom of God.
And the Holy Ghost can be given before baptism by water as shown in John as well as in Acts 10:47 as is shown us in the the Gentiles as Peter points out
Acts 10:47 Can any man forbid water, that these should not be baptized, which have received the Holy Ghost as well as we?