This odd behavior of Task.Delay is fixed starting of .Net7. And in the general situation, the CancellationTokenSource.CancelAsync method was added in .Net8.
Task.Delay
CancellationTokenSource.CancelAsync