Prequisite for implementing pausing in the debugger. This will be part
of the `ThreadActor` response to `interrupt`. I decided to split the
change in multiple patches since it is quite big. Continuation of
#38824.
Testing: Deferred until the pause is fully implemented.
Fixes: Part of #36027.
Signed-off-by: eri <eri@igalia.com>