A GLOBAL TEMP table (where the DBA runs the CREATE GLOBAL TEMP TABLE once (so that CREATE TEMP TABLE some_table everywhere that my_func() is called) would also solve OP's problem.
Per the create table docs:
"Optionally, GLOBAL or LOCAL can be written before TEMPORARY or TEMP. This presently makes no difference in PostgreSQL and is deprecated; see Compatibility below."
And I'm praying for "since future versions of PostgreSQL might adopt a more standard-compliant interpretation of their meaning" in the Compatibility section you referenced.