Despite the success of the Prius, Toyota made a decision to focus exclusively on fuel cell technology and wasted ten precious years. After Toyota lost that bet, Tesla's superior EV technology could have helped Toyota catch up with the competition. Tesla had no experience with the formidable supply chain and production issues involved in building high-quality cars on a large scale. This is one of Toyota's great strengths.
Unfortunately, there seemed to be bad blood between Toyota and Tesla management. I suspect this may have prevented consideration of such a partnership.