It's not hard to divine the reasoning behind the move. In-house cells would let Tesla optimize its battery packs for its cars, whether it's longer range, more acceleration or better sustained performance. This could also cut costs by eliminating go-betweens like Panasonic, making that $25,000 EV more feasible.
Moreover, it might provide a failsafe in case the relationship between Tesla and Panasonic goes south. The Japanese firm recently froze its investments in Tesla's Gigafactories, however temporarily, and it recently reached an agreement with Toyota to make car batteries. Elon Musk also blamed Panasonic for serving as a "constraint" on Model 3 production. Internally-designed cells could ensure that Tesla isn't held back and, as technology VP Drew Baglino put it, make the company the "masters of our own destiny."
This doesn't mean Tesla is about to drop Panasonic completely. It still needs its partner in the short term, and Panasonic's capacity might be crucial as Tesla expands its reach. Panasonic might just want to have a backup plan in case it's no longer the center of Tesla's universe.