The cause of Nagidal's (and other sufferers') problem is not a DFHack issue, but a possible fix could be...
I don't understand how reading the DF memory could screw up the data structure (while not saying it's impossible just because of my limited imagination), but making use of it (as in changing character data, such as nick names, job allocations, etc.) might. Also, I would advice against doing DT changes while DF isn't paused.
If DT can cause the issue, it would probably be good to have a save where you an provoke it with some degree of reliability to investigate what's happening.
I would be careful with saving in the middle of a migrant/caravan/siege arrival, though, as I believe that has been thought to trigger the issues.
With the merchants I looked for units that were merchants and some other criteria. With migrants I'd start to look at the end of the unit list and also the unit ids following the next visible ones. However, poking around in a bugged save is probably the only way to figure out how to identify the bugged ones (except, of course, understanding what causing the problem and address that, but we seem to be far away from that, struggling with trying to address the symptoms). In fact, I had intended to look at Nagidal's problem about now if a save had been provided.