I have been proven wrong in the comments. Thank you
Well! They gave us an end credit scene!
Good point. Thank you
Basically its a very long chain of events but,
If Odin wasn't a terrible father Loki wouldn't have made the frost giants ruin Thor's coronation which means Thor wouldn't have been banished which means Loki wouldn't have gone to Earth which means the battle of New York wouldn't have happened which means Loki wouldn't be taken prisoner which means he wouldn't have betrayed Thor and put Odin under a spell which means Odin wouldn't have died which means Hela wouldn't have escaped wich means Asgard would still be around which means half the Asgardians, and Loki would still be alive which means Thor wouldn't have wanted revenge which means he would have gone for the head (or arm) which means Thanos would have never won. Basically
If you look at it through a butterfly effect, If Odin was a good father Thanos would have never won.