=rem #16428 optimize protobuf serializer for master

#16428 for master
I’m not sure what we are discussing here: the outer `@tailrec` is clearly superfluous and misleading, so just remove line 51 and be done with it? 

More explanation: The code structure is just fine, the only problem is that when I see `@tailrec` I assume that this may recurse deeply, potentially unboundedly, while actually the maximum depth here is two.