Yes, that's true, thanks for mentioning it. It comes from a time when I did not use docker so I wanted to get rid of build artifacts, but building within docker, this is not a problem anymore.
If you need to use your "old way" for something else, you can use 'git clean -fdx' which will remove all files and directories that git does not track.