protoc_plugin: Sync a minor refactoring from internal
protoc_plugin: Sync a minor refactoring from internal

dart-lang/dart-protobuf,dart-lang/protobuf,dart-lang/protobuf,google/protobuf.dart,google/protobuf.dart,google/protobuf.dart,dart-lang/dart-protobuf,dart-lang/protobuf,dart-lang/dart-protobuf