Wouldn't it be sensible to sort messages in a MidiMessageSequence so that note off events are ordered before note on events if the time stamp is equal? I ran accross several occassions where i could save some corner case handling if that would be a safe assumption. For example consider a sequence where the same note is played twice without a pause in between. On playback a MidiBuffer is filled with the appropriate events. Now if the note off is added after the note on event timing of the note will be wrong for most plugins.
If you are affraid of breaking existing implementations maybe you could add a MidiMessageSequence::sort() method that takes an ElementComparator as parameter?
As far as I can see, looking at the code, the sorting of a midiMessageSequence "retains the order of equivalent items", hence it shouldn't alter the order of noteon/offs (or what ever other midi message you have) if their timestamp are equal.
updateMatchedPairs(), which pairs noteons with a corresponding noteoff and often is called after a midiMessageSequence.sort(), does some dubious things however; if it finds a noteon after another noteon of the same key without any noteOff in between, it will self-righteously insert a new noteoff immediately before that second noteoff.
This makes it impossibly to have several voices of the same key sounding simultanesously (to thicken the sound maybe) in the same channel.
But that's not your problem if I understand you correctly, you merely want to play the same note two times immediately after each other and that shouldn't present any problem with the current juce midi implementation. As far as I can see. (Caveat: The code I'm looking at is a few months old...)
If this doesn't make sense to you, your welcome to post an example of your unruly midi file.