Although you seem primarily interested in the reasons why US/Silicon Valley software companies hire locally, I think it is also interesting to answer this question from a non-US perspective. In other western countries with high local salaries, (a large part) of the codebase and/or documentation might actually be in German, Dutch, Norwegian etc. Even if the codebase and documentation are in English, the users of the software might not be fluent in English and might prefer to interact with employees of the software company in their native language. This all makes the pool of suitable cannidates in low-wage countries far smaller/almost non-existent.