Mmh, couldn't reproduce so far. I should try testing the following case: Background project disabled, direct MIDI hardware device as MIDI input, control of a track target, go to other project tab and play around a bit with the source.
Other weird things:
Track names displayed in mapping window of ReaLearn instance in inactive project are wrong (everything "<Master track>")
It's possible to let ReaLearn control something which is not in the same project tab as ReaLearn. We should prevent this!
Can and will be fixed in this ticket. However, REAPER still reports track number incorrectly for tracks in other project tabs. I sent a bug report to Cockos.