Blob store-based gateways shouldn't serialize transient metadata

Fixes #5615

I would like to merge the first commit b0172c0 to 1.1, 1.x and master since it looks like a good change anyway. The second commit will go only to 1.1 because 1.x and master no longer have blob store based gateways (S3, shared filesystem, etc).