Oh I overlooked the workaround mentioned in that issue, which doesn't seem to cause noticeable performance overhead:
In C#:
private struct MyResult
{
public IJSObjectReference? Value { get; set; }
}
js.InvokeAsync<MyResult>(...)
In JavaScirpt:
return {
value: something ? DotNet.createJSObjectReference(something) : null
};