FASTQ file reads extraction paired ends
Your question can be rewritten as, &quot;how do I get the union of reads in two files?&quot; Since you have already subset the mates, the steps are:

Process each file, storing the list of reads names in each.
Take the union of these.
Iterate through the original/non-subset files and write only the reads with names in the union to the output.

The files will be both subset correctly and synced properly such that bowtie2 or any other aligner can correctly process them.