You could put all the users in a single document with Unique ID and data like following:
Then you could use a Cloud Function and that will execute following things:
Retrieving the Array called waiting from a specific document. It
will add new account user id to that array.
If the array has got at least 2 elements. It will add a new
array of maps named paired from the 2 elements from the waiting list and
add the value to firestore. It will call the existing paired
array and add the new 2 elements and save it to Firestore. Also update the paired_with field in
users doc.
It will remove the 2 elements from waiting list update an empty
list.