Aren't most index funds, almost by definition, required to buy their shares? If Vanguard owns a piece of every listed company, they're going to buy Uber at pretty much any price, right?
They don't hold Lyft because of their dual-class share structure.
Yes, Vanguard will buy at "any price" and will buy more at a higher price -- the funds try to replicate the breakdown of the underlying indices on a market cap basis.
If it falls within fund's target they should just buy it, without thinking. That's the point of low cost ETFs.
There's even a known arbitrage opportunity with things like S&P500. When the S&P committee decides to include a new stock (and delist some other stock) you can front-run the purchases by the giants like SPY or VOO, slightly inflating the stock's value just when the ETFs buy it from you.
The purpose of an index fund is to buy the entire market, under the assumption that an active fund will not outperform the market (after costs). If you want to avoid certain companies, you should buy an actively managed fund.
There are different types of index funds. There are market capitalization weighted index funds that fit your description of buying the entire market, but there are also small cap funds, sector funds, value funds, etc. You can avoid certain companies (e.g. FAANG stocks) by buying certain indexes (e.g. a value index).