Bad advisors probably set me back at least a year and my former labmates as much as 3 years when they quit the lab shortly before our former advisor "resigned". I eventually took matters into my own hands and helped two professors I liked write an NSF grant on my topic and got funding for two students for 3 years, and they basically let me do whatever I want.
No doubt, but as you note, your mentor will impact you for years and perhaps your entire career. If the right one doesn't come along, better to wait. Many schools also won't tell you that you've been admitted to the program and the mentor they've assigned isn't set in stone. Ideally, use the time during visits and interviews to identify the best mentors in the program. A good mentor will get you through the program. A bad mentor will actively sabotage your progress. To me, it's most the important decision you'll make, especially if as you note, the funding is tied to the mentor.
I eventually took matters into my own hands and helped two professors I liked write an NSF grant on my topic and got funding for two students for 3 years, and they basically let me do whatever I want.
Take note: If there's one way to punch your own ticket, it's this approach. Acquire your own funding and you're pretty free to do what you want. In that regard, grants may be more powerful than even publications.
Perhaps this belongs under a post called "10 hard ways to fail a Ph.D."
An advisor-advisee mismatch can be excruciating.
For established mentors - Full or Associate Professors - if they aren't actively graduating students, there's something wrong. If they have current students who are taking, on average, 7 to 8 years, there's something wrong. If you want a tenure track position and this established mentor doesn't have a record of placing their students in those positions, there's something wrong. The concept of lineage really does help. Great mentors really do seem to birth new ones. If a particular mentor has a limited lineage, look elsewhere.
Otherwise, I actively consul folks to stay clear of nontenured faculty as primary mentors. As I indicate above, those folks have pressing priorities elsewhere. If you like someone who fits in that category, get a more senior mentor as your primary and add the younger one to your committee. Just make sure the primary is truly signing off on everything. The politics are always there, especially with a nontenured trying to prove themselves, but they are manageable with some savvy. The point is: Stay clear of the nontenured without a safety net. Not only are they distracted, but they have no standing to advocate and defend you, if necessary. You're easily expendable when the choice is you or their career.
Basically, mentors can be classified based on where they sit in the career trajectory and their history. If they don't have a clear and steady record of graduating students, then don't expect you'll be different.
That being said, I always tell other students to remember that their interests are most often orthogonal to that of their advisors and that ultimately they are their only advocates. Also, choosing an advisor needs to be assessed on a case by case basis.
I know of two criteria for tenure: Publications and grants. Student advising is not going to shift that calculus dramatically in any direction.
Nontenured faculty may be great but it's potentially too problematic to have one as a primary adviser. Too many unknowns affect their emotional and professional state to tie your ship to theirs. Better to get a more senior person as the primary mentor and then form collaborations with, and get advice from, the nontenured faculty.
For sure, it's a case-by-case consideration. A nontenured faculty with graduating students before they receive tenure is a good sign along with grants and publications. But a tenured faculty member is better equipped, at least politically, to look out for their students. If they don't have a record of doing so, stay far, far away.
My main point is that I don't think you can really say one is safer than the other. I certainly think early tenure track faculty have greatly divided attention and are under incredible amounts of pressure, which is not a good prescription for being a good advisor, but I think that a lot of what tenured faculty people do also can make them poor advisors.
As a student you will always be working with incomplete information, in particular, how you will handle a given advisor, even if everyone else says they are great (or horrible). Of course you have to simply play the hand that is dealt and make changes to your situation when appropriate.
On a side note, I was able to get one very senior person on my committee, who is very enthusiastic about my project. Even though he is not my direct advisor, he has been able to strongly advocate for me when necessary.
1) Pick the wrong mentor.
Quite simply, if a mentor hasn't graduated a student in the last three years, serious red flags should go up. Professors can get a ton of work done relying on research assistants and post-docs. But students need to be nurtured and many mentors just aren't up to the task. Their track record at graduating students is the best evidence you can ask for. Look for potential role models in that history.
If the mentor is a nontenured professor, ask for their advice but don't make them your lead mentor to sign off on your work. Tenure has many stresses and some are orthogonal to your interests as a student and future researcher. The nontenured need to be focused on themselves until they get tenure. They can have a lot of energy and novel thoughts, but since your results will be tied to their future prospects, your work will get undue pressure.
The edge case is the newly crowned associate professor. Fully interview the prospective mentor and get references. Your career will literally be in this person's hands. Make sure you know that this is a person who will challenge and inspire. Associate professors can be really, really great mentors, but you just have to be careful if they haven't graduated any students. If they have, and those students are already on tenure tracks, you likely have an excellent candidate.