Implement serializable in ReferenceList

Relying on SplObjectStorage serialization seems to be problematic, especially when used with a large Item.

This converts the ReferenceList to a plain array of Reference objects when serializing, which is more reliable.

This appears to resolve the problems with ReferenceList objects becoming corrupt. (tested locally with trying to view a diff or undo)

Bug: 71479
return serialize( iterator_to_array( $this ) );