During the second episode of Disney Gallery: The Mandalorian, director/writer/executive producer Dave Filoni talked about how if Qui-Gon had survived, he would have trained Anakin differently than your standard Jedi.
So Qui-Gon leaving the Order with Anakin is already a good step towards ensuring he stays with Team Light Side, but it goes further than that.
There were a variety of factors that contributed to Anakin Skywalker turning to the Dark Side and becoming Darth Vader, including him feeling stifled by the Jedi Order’s numerous restrictions.
He would have taken a more fatherly approach with Anakin’s care than the brotherly approach the youth got with Obi-Wan, and that would have made all the difference in the world, as Anakin needed a father figure more than a brother.