Tunable self-assembly of magnetotactic bacteria: Role of hydrodynamics and magnetism