avoid unnecessary copy in cache code path (#11348)
avoid unnecessary copy in cache code path (#11348)

### Problem

https://github.com/pantsbuild/pants/pull/11344 introduced a `.to_bytes()` helper for protobuf messages. However, in one spot, this introduced a unnecessary copy because the result is converted to a `Vec<u8>` immediately.

### Solution

Remove the unnecessary copy by encoding into a `Vec<u8>` directly. 

It might be possible to switch the `PlatformAndResponseBytes` struct to use `Bytes` instead of `Vec<u8>` but that would require reasoning about whether it would change the format of the struct when stored in the cache, which I want to avoid having to do for now.

### Result

Existing tests pass.

benjyw/pants,jsirois/pants,benjyw/pants,benjyw/pants,benjyw/pants,jsirois/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,benjyw/pants,benjyw/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,jsirois/pants,pantsbuild/pants,benjyw/pants