I’m having a bit of an issue reading your code without formatting but you don’t need to unwind to use $lookup. If you pass an array of values to $lookup (via localField) it will be the equivalent to running $lookup on each of the values in the array separately (except it’ll be faster). So it sounds like maybe you need only one $unwind and not two.
It would be easier if you provided a sample input document as well as the output you desire.
Asya
P.S. you might also want to tag your question with aggregation tag.