... instead of when leaving the passage.
There isn't a "leaving the passage" event as such, only a "show this Passage instead of the current one" activity.
After a very brief look at the Harlowe source code, as I understand things variables are stored in one of two places:
1. Story variables are stored within the current Moment of the (Story) State system, which is why they are available to activities that occur after the current passage has been shown.
2. Temporary variables are stored in the Section that they were defined in and a Section is used to represent the Passage about to be shown, or in some special cases one of that passage's sub-components which results in the "Passage" Section containing child Sections.
The (parent) Section seems to only exist during the process that first converts (compiles) the contents of the Passage into the equivalent HTML elements / CSS styling / JavaScript code, and then adds all that to the current HTML page that is about to be rendered.
This would explain why the Temporary variables aren't available after the above process has finished.