The ugprade should have put in the correct context id, and as you say, it must have done because it worked in 2.1. Something odd must have happened during the upgrade to 2.2, but I cannot think what.
Anyway, it should be fixable. This query should find the problem rows
SELECT qu.*, ctx.*
FROM o_question_usages qu
JOIN o_quiz_attempts quiza ON quiza.uniqueid = qu.id
JOIN o_quiz quiz ON quiz.id = quiza.quiz
JOIN o_course_modules cm ON cm.instance = quiz.id
JOIN o_modules mod ON cm.module = mod.id AND mod.name = 'quiz'
LEFT JOIN o_context ctx ON ctx.instanceid = cm.id AND ctx.contextlevel = 70
WHERE qu.contextid <> ctx.id
If that seems to be working, I assuem you will be able to edit that to do the appropriate update. (That is the sort of thing where you should probably backup the database first.)
If that is not enouh information, get back to me.