So you contribute $18,000 to a Roth 401(k) and then you're done for the year. It doesn't matter if you withdraw the money - you still contributed $18,000 that year. You'd have to ask your employer both about recharacterizing contributions and withdrawing money from a 401(k) while still employed there.
Annually an index fund has 2% dividends, but you'd be switching to regular 401(k) before getting the December dividend... so call it 1.5% dividends. With $18,000 in taxable, that would be $270 in dividends. In the typical tax bracket, qualified dividends are taxed at 15%, which means owing $41 tax on the $18,000 invested in taxable.