Fix Mako templates to use latest request context

Fixed the edX middleware to lazily create request
context for Mako templates, so that it is based on
any changes made to the request object.

Verified that with this fix the "Instructor" tab is
correctly hidden when a staff member is viewing
the course as a student.
Merge pull request #6189 from edx/andya/fix-masquerade

Fix Mako templates to always use updated request context