On the mean number of $2$-torsion elements in the class groups, narrow class groups, and ideal groups of cubic orders and fields