But if the dark matter gravitationally affects the visible matter in the galaxy, then the visible matter in the galaxy should gravitationally affect the dark matter. So even if there was reason for the dark matter to initially assume that shape, what's keeping it in that shape against the pull of the visible matter?
> what's keeping it in that shape against the pull of the visible matter?
Dark matter halos do flatten out, just much more slowly than baryonic matter, since gravitational interactions radiate off energy much more slowly than electromagnetic ones.