Tesla seems to be making the opposite gamble - that the grid-attached storage market will give the large-battery market economies of scale and help the EV market (and the other way around). They're building a very-large-scale battery factory, and probably cannot utilize it fully just on building their own cars.
Even if massive demand for batteries driven by grid storage makes EVs uneconomical, Tesla is setting themselves up to build and sell the batteries, so they win either way. (Well, aside from their goal of having the entire planet transition to EVs. They win financially.)