Commutator theory for racks and quandles