How important are graduate courses to a successful PhD and beyond?
I am worried that if I start my PhD without having good courses I will be under-prepared to handle challenging problems later, and [various bad things]

There are a few things to note here that might put you at ease.  Firstly, while it is true that the quality of the material and instruction in a course certainly matters, even more important is the drive and work ethic of the student.  Depending on your willingness to engage deeply with the material, and search out other material, you can pretty much make your course as rigorous as you want it to be.  If you find that there is a gap in the material in some respect (e.g., some mathematical assertion that is not proved and that you don't know), look up other material to supplement what is in the scope of the course.  Since you are a PhD student now, one of the things you should be getting good at (or at least practicing with a view to getting good at it later) is looking up other sources of material to supplement gaps in knowledge.
Beyond taking courses as a student, a very effective way of learning a topic is to teach it.  Since you are a PhD student, you should have some opportunities to tutor some of the early undergraduate courses in your field, and maybe even some of the later undergraduate courses.  If you become an academic, you will probably end up teaching both undergraduate and postgraduate courses.  Teaching a course requires you to fill out a deep and systematic knowledge of the subject that goes well beyond what was required of you as a student (even as a high-performing student), so it is a very effective way to solidify your knowledge.  Obviously right now you will not be teaching your graduate courses --- you are the student here.  But you can look for opportunities to teach into some early undergraduate courses, which will get you on the path to solidifying your knowledge of foundational material at a deeper level.
Finally, don't make the error of thinking that your learning ends when your coursework ends.  Even after you have finished all your courses and you are doing pure research, you will find yourself exposed to thorny problems that necessitate learning new material, or going back and relearning material you have previously studied and forgotten.   Often a formal course undertaken in graduate school is just the first iteration of learning a topic --- you do the course and learn a bunch of things, and then if you don't apply them for a long time (e.g., years or decades) you forget a whole bunch of it, and then when you need that material you relearn it, and so on.  The main advantage of doing the formal coursework in your training is that when you find you need to relearn it later on, it is a lot faster.