less racefullitude in installs with many git dependencies

See #7006 for details on the problem, which this PR fixes (or attempts to fix) by replacing a recursive permissions change with 2 non-recursive changes. This should also yield a small but noticeable performance increase on git-heavy installs due to the much smaller number of filesystem operations done.

Needs a test. Don't know how to write a test. :fried_shrimp: