You are absolutely right.
But if you want to predict all tokens, can’t you just leave target_mapping to the default (None)? From the docs:
If target_mapping is None, then num_predict corresponds to sequence_length.

Or is your point that this mapping does not take into account the different sequence lengths in the batch? If that is the question, I cannot help with that. I do not have enough experience with XLNet. Perhaps someone else can chime in.