Gigafactory is a joint venture between Panasonic and Tesla. But either way, in a world where demand for batteries far outstrips supply, the contractual ability to buy a greater quantity — knowing they can be sold profitably in any form factor — is an asset. Underpurchasing would be squandering that asset.
No idea if this is true, but Tesla might have a contract for X batteries at Y$ but only end up needing Z<X for its car sales. In every industry it's a good idea to find a use for excess materials.
Tesla buys batteries from Panasonic. Why would Tesla have excess supply?