Investors who shift away from stocks for perceived safe havens like cash are likely sacrificing their well-being decades from now.