Yes, you would have to add the file yourself to the index.
The pre-commit hook allows you to run some commands before committing, that doesn't mean that git will keep track of the modifications made by your hook (or anything external).
That being said, I cannot recommend this kind of practice. Even if it isn't exactly the same thing, it's similar to compile your application and add the result of the compilation to your commit on the fly.
In my opinion, the automatic changes of your code should be done during your build or before your deployment and should have nothing to do with your VCS.