Why so many portuguese noun groups of the form [-o-o, -o-a, -a-o, -a-a]? How to learn them?

Why are there so many 4-tuples of portuguese nouns of the form:

[ C(C)oC(C)o, C(C)aC(C)o, C(C)oC(C)a, C(C)aC(C)a ]

in which all 4 words are legit portuguese nouns?

For example, below are all legit portuguese nouns:

  • coco/coca/caco/caca
  • colo/cola/calo/cala
  • golo/gola/galo/gala
  • goto/gota/gato/gata
  • molho/molha/malho/malha
  • moto/mota/mato/mata
  • posto/posta/pasto/pasta
  • soco/soca/saco/saca
  • troço/troça/traço/traça

This is very confusing and easy to messe them up. How to learn their differences by heart and avoid messing up?