protozero: Improve runtime of cppgen enum/type gen
protozero: Improve runtime of cppgen enum/type gen

Also track seen enums/types in sets to avoid quadratic runtime of
lookup during recursion.

Bug: chromium:1017699
Change-Id: I52494c0d4e17abb8de49e052272481df8d17f33f
google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto