samtools mpileup empty when filtering out flags
By using -h in the samtools view command, you're including all the header lines in your word count. If you happen to have about 89500 reference sequences, then the lengths of those would all appear in the header and inflate the -h word count, but not the mpileup count. Try piping it through an additional samtools view (i.e. without -h) and see if the counts change:

...
samtools view -h -f32 -  | \
samtools view | wc -l


Also, samtools mpileup by default only considers high-quality bases and concordant reads. Try adding a -A to your mpileup line (which stops anomalous read pairs from being discarded):

...
samtools mpileup -A -Q0 -B -d 999999 - | wc -l