direct indexing helps with this as well --- own thousands of individual stocks that collectively act as an index, and trade in some losers for their similar competitors every time you have to realize gains
But it's not exactly the case you could pull this off with, say, Tesla, unless there's some ETF that's 99% TSLA (is there?)