fix #8551 and make stack switch more efficient

previously, each new stack would have a copy of a small portion of the
stack that started it. in small amounts, this was fine, but it is bad if
the user is starting many tasks. additionally, it wasted memory inside
every task to have a per-task base_ctx.