Previous research experience might help, but there still are a number of factors that need to align in order to have a relatively smooth PhD. In my mind, it depends on the quality of your previous research experience, your advisor, and your goals upon graduation.
For my experience in particular, I did two summers of research at an R1 when I was in undergrad. Continuing on that path, I went to graduate school for my PhD. I am five years in; looking back, I was still extremely unprepared for the realities of research. When I did the undergraduate research, my hand was being held by the PhD students I was working under. Sure, I did some interesting stuff, but I received a substantial amount of guidance. Now in graduate school, my PhD advisor is very hands off, and our group tends to work in isolation. I have to push my research forward on my own. It took me years to get used to this, and not feel completely incompetent. My previous research experience was not a good predictor of my life as a PhD student.
In my mind, the best preparation would be to do a thesis-based masters degree and try to publish during that.