Remove the possibility to create an infinite loop in SessionHelper.

By removing the session data *before* rendering the element, we avoid issues where the element will try to re-render the session flash causing an infinite loop.

Refs #4350