Return the previous value of profiler_name_scopes when setting it.
Return the previous value of profiler_name_scopes when setting it.

This is necessary to locally enable/disable the setting and then restore it to the original value.

PiperOrigin-RevId: 331519892
Change-Id: I9deabcf77ea3e06b20974e893dabe660f3428103

deepmind/dm-haiku,deepmind/dm-haiku