[NFC] Extracted emitPackExpansionElementMetadata.
The function emits the metadata for the element of a pack expansion at a
specified index. It was previously defined inline in the loop--defined
in emitPackExpansionType--which populates a new metadata array with
elements derived from a preexisting array. It will be used to emit a
single element in the case that only one is needed.