Is MainActor.assumeIsolated truly necessary in deinit for a @MainActor annotated class?

I was able to fix the issue by using dispatch queue to make sure it's on the main thread and executed without delay

    deinit {
        func cleanup() {
            MainActor.assumeIsolated {
                // call to MainActor code
            }
        }
        if Thread.isMainThread {
            cleanup()
        } else {
            DispatchQueue.main.async {
                cleanup()
            }
        }
    }