@Miranda : The butterfly appears to be a female Heteronympha merope. This butterfly does not make a cocoon, so what is the relationship between it and the cocoon and its larva? Did you break open the cocoon to reveal the inhabitant?
Yes sorry it's not very clear - @HelenCross is right, I think there is an adult moth head down in the middle of the chewed bit feeding on sap. There were dozens of common brown butterflies feeding from these chewed patches, plus this moth.
OK I think this is solved - @Christine you're right, it's a pied lacewing. If you look closely at the cropped image you can see that its head is hidden under a sliver of wood with an antenna poking out. So it looks like it has a blunt head like a moth, rather than a 'neck' and pointed head like a lacewing. That's why I thought it was a moth. Thanks everyone!