Supernilpotent groups and $3$-supernilpotent loops