This verse could be reordered to be more clear. Alternate translation: "When all the people who had been baptized by John, including the tax collectors, heard this, they declared that God is righteous"
This can be stated in active form. Alternate translation: "because they had let John baptize them" or "because John had baptized them" (See: [[rc://en/ta/man/translate/figs-activepassive]])