To use a different example someone brought up - imagine your CPU breaks in your laptop. You send it to the manufacturer, and they replace it with a higher model CPU because <reasons> - cool, right? You sell it advertised with that better CPU, then the next owner has to send it in for another, completely unrelated repair, and the manufacturer then says "oh we noticed the last repair fitted more powerful CPU than intended, so we removed it and fitted the original spec CPU".
That wouldn't be just immoral, that would be actual theft.
The matter of fact is, after the warranty repair the guy was given a car with a bigger battery and the bigger capacity enabled in software. Whether Tesla intended to do this or not, is completely and utterly irrelevant - it was his to keep and sell. Now Tesla taking this away should be(but probably isn't) illegal. You have a product with a feature X, Tesla removed that feature and in fact holds it ransom for payment - the fact that they never intended to install it is irrelevant.
To use a different example again - imagine you buy a new car and the factory made a mistake and fitted an extra option that you didn't order. Is the manufacturer in the right to remove that part during your next service?