While Tesla shares freely their patents with other manufacturers, they publish these patents to show others the way.
If another company patents this technology first, then they can prevent Tesla from using it on their own production.
Classic example is when Indian was suffering competitively from the far superior clutch system on Harley Davidsons. Indian patented Harleys technology and filed suit to prevent Harley from continuing to produce the design Harley themselves had invented. Almost put Harley out of business.
Tesla need to patent their new stuff to allow them to keep producing them.