DynamicSoundEffectInstance.XAudio sometimes not flushing buffers correctly

I am using the DynamicSoundEffectInstance class to generate sound out of a gbs file in my game. While trying to offload the sound generation onto another thread the music tracks would sometimes break after I started them. After looking into it I found the problem.
Calling PlatformStop in DynamicSoundEffectInstance.XAudio.cs seems to sometimes not remove all the buffers. This will lead to OnBufferEnd deleting buffers that are currently still in the queue and are waiting to be played. This leads to broken audio.

One fix for this problem is to check the buffer length from _voice in OnBufferEnd to not remove buffers that are still in use:
if (_queuedBuffers.Count > 0 && _voice.State.BuffersQueued < _queuedBuffers.Count)

I think this has to do with _voice.Stop() sometimes not directly stopping and _voice.FlushSourceBuffers() not flushing the buffers because of this.

Does this look like a fix that can be integrated into monogame?