No PhD candidate gets to their viva or passes because they are lucky.
When we reduce the situation to the simplest terms, a PhD candidate submits their thesis and succeeds in the viva because they work hard and enough of that hard work pays off.
PhD success is not a lottery. You have to work hard. When you do enough, fortunately you find what you need.