The principle you have referred to regarding insurance is correct, but there is a subtle yet important difference between the two cases which needs to be understood.
In insurance, the primary business of the company is insurance itself — mutual help through a pool of premiums — which is Halal. What the company then does with that pool as a mode of investment is secondary to its primary business. Ideally, that too should be Halal, but it is not something the insured person can be held responsible for.
In mutual funds, ETFs, and index funds, the situation is different: here the primary activity is the investment in the basket of portfolios itself. By buying into the fund, the person is directly involved in, and therefore responsible for, the investments being made on his behalf. This is what distinguishes the two cases, and it is why more care is required here than in the case of insurance.
Ideally, all of the investments should be Halal. However, in cases where a minor portion ends up invested in Haram businesses and no better alternative is available, then that minor portion — or one’s best estimate of the income belonging to the objectionable investments — should be given away in charity. You are right that precise tracking is impossible in a fund dealing with thousands of companies; that is why a reasonable best estimate suffices. Allah does not burden a soul beyond its capacity, but He does expect us to do what is within it.
As for Shariah-compliant funds: if a prescanned portfolio of Halal investments is available, it is always better to opt for it. The return may be lower or the fee higher in comparison, but for a Muslim, the sense of piety should outweigh material gains. That said, if such an option is genuinely too risky or too expensive, then of course it is not feasible, and one may invest in a conventional fund of predominantly Halal businesses on the terms described above.
Just for reference, giving objectionable portion of income in charity is not something new. Ghamidi Sahab has said the same w.r.t interest earned in a Savings Account.
And Allah knows best.