Task in @MainActor Function Appears to Become Detached

You're right that there's no such guarantee today.

However, we are working on providing more guarantees there; see this ongoing pitch: `@isolated(any)` function types