I think that the rendering of your twig is done after the request has fired.
So lets assume you have an url param foo,
then in the controller where you render the normal twig template you add foo and its value to the data that twig uses to render.
Inside your twig template there is a call to your extension.
{{ myExtensiom(foo) }}
twig will first render the template, then sees your extension and calls it, with the value that foo represents.
In my basecontroller, I have my view ( $this->view = $container->view;)
and in that I can put a global value, available to all templaes that I render.
$this->view->offsetSet(‘foo’, ‘a value that you decide’);
In this case, you don’t have to set it at each controller action 
Hope this helps.