Impl `serialized_length()` without `LengthCalculatingWriter`