It is actually easiest to think of it this way. If the FLEX is playing defense, then no matter what other job that position assumes (i.e. batting, running), then that player has never been subsitituted for. The FLEX's primary job is to play defense.
The DP's primary job is to play offense, so, if the DP is playing offense, it doesn't matter what other job that position takes (playing defense) they are still not substituted for.
Now, if either the DP (offense) or the FLEX (defense) are not doing their primary jobs, they have been substituted for and are entitled one re-entry.
And we have now successfully hijacked this thread.