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.