On the origin of degeneracy in the genetic code