Salvation/rebirth/regeneration could occur
before, or
after, or even
during baptism. It shouldn't be after, but it may (and in such a case they probably need to have a new "believer's baptism", but anyway you get my point).
Note: it's not heretical for someone to say that they were saved
when they were baptized, if that's when they really
repented or
"called on the name of the Lord". In fact in the book of Acts it seems typical that people "called on the name of the Lord" or "repented"
through/at their baptism (or so effectively close to their baptism that it was all seen together as one thing):
Acts 2:38 "Peter replied, "Repent and be baptized, every one of you, in the name of Jesus Christ for the forgiveness of your sins. And you will receive the gift of the Holy Spirit."
Acts 22:16 "And now what are you waiting for? Get up, be baptized and wash your sins away, calling on his name.'"
'Course it's not the actual water that saved them, but their calling on the Lord (i.e., repenting), as Paul did in his baptism above, and as Peter says here:
1 Peter 3:20-21: "... in the days of Noah while the ark was being built. In it only a few people, eight in all, were saved through water, and this water symbolizes baptism that now saves you also —- not the removal of dirt from the body but the pledge of a good conscience toward God. ..."
So it's the
"pledge of a good conscience toward God" (or equivalently, repentance, calling on the name of the Lord, etc.) that saved them, but it seems that this "calling on the name of the Lord" was typically done through/at their baptism.
I was born again and set free from some particular bondage of sin months before I was baptized. My life was totally changed, before I even knew/learned that I should be baptized. It happened in my living room; I cried out to God about some particular sin, and after that, I noticed that the particular sin had miraculously stopped! (So, I know I was "born again" at that point.) Then, later, after getting involved with a Christian group, they encouraged me to be baptized, and I was.
But in the book of Acts, it seems that baptism was always immediate (immeidate upon accepting/believing the gospel).
I did student ministry for several years in Thailand and was blessed to see a number of Thai and Chinese and Korean students come to faith in Jesus. The Asian churches around us would do a "sinner's prayer" and then do a baptism
months (or even
one year) later (if a bunch of requirements were met). But as for me, I kept it simple, trying to follow what I see in Acts. After making sure they understood and believed the gospel, I took them to the university swimming pool (usually with some witnesses), and baptized them in the name of Jesus, while making sure they repented or "called on the name of the Lord" right then and there at their baptism. Perhaps some were actually regenerated
before reaching the pool

, perhaps some were regenerated
in the pool

and perhaps a few weren't regenerated at all (or may be regenerated
later). There was at least one who totally fell away from the faith after his baptism and denied the faith both verbally and with his life -- so in his case the answer is either
after or
never.