fix: sanitize worker args for worker_threads compatibility (#90506)
### What?
Sanitize worker method arguments when `enableWorkerThreads` is true to avoid `DataCloneError`.
### Why?
When `enableWorkerThreads: true` is set in the build static worker, `postMessage()` uses the structured clone algorithm which throws `DataCloneError` on function-valued properties (e.g. `generateBuildId: () => null` from the default config). The default `child_process` mode uses JSON serialization which silently drops functions.
### How?
Adds a `JSON.parse(JSON.stringify(args))` sanitization step for worker method arguments when worker threads are enabled, stripping non-serializable values before they reach `postMessage()`. This is a no-op when using child_process (the default).
This is a temporary workaround. The proper fix is to stop passing non-serializable objects (like the full `NextConfigComplete` with function properties) to worker methods in the first place. The main offender is `exportPages` in `export/index.ts` which passes the entire `nextConfig` object. Callers should be updated to extract only the serializable fields the worker actually needs, similar to how `isPageStatic` already does it. Once that's done, this sanitization can be removed.