That plugin takes data from different sources: questions, users, tags, questions lists for each category and pages in category. Now, how would you fill that lastmod field for each of those sources?
Lets take the questions one, which should be the easiest one. I guess a good approach here would be the one similar to the Activity page. So you get the last mod from crossing information of the question, answers and comments, and the last one in being edited or posted is the one from which you will get the lastmod.
Doing that for each question in the site will kill your server. So you might be tempted to just use the information from the question itself but you will only get the asked or an edited date, even if new answers are being added to the question. So, it wouldn't help much for the questions.
Regarding users' source, the lastmod doesn't seem to make much sense. You could consider using a logged in date but that has nothing to with a last seen so it would be again considerably fake.
Regarding tags maybe it would make sense to get the last question for each tag but again, doing that for each tag will still considerably decrease performance.
Categories I guess they fit in a similar place as tags.
So it is not something complex but it is not performant at all. If you want to develop this on your own, then you can start from this branch in which I've tuned performance of the plugin a little bit: https://github.com/pupi1985/question2answer/commits/patch-38