And here's the magic line:
ffmpeg -i input.mkv -map 0:v -map 0:a -map 0:s? -map 0:d? -c copy -c:v:0 av1_qsv -preset veryslow -vf "format=p010le" -extbrc 1 -look_ahead 1 -look_ahead_depth 40 -extra_hw_frames 40 -tile_cols 1 -tile_rows 1 -q 32 -low_power 0 -adaptive_i 1 -adaptive_b 1 -b_strategy 1 -bf 7 output.mkv
I'm a little proud of myself for getting it working. Most of it isn't documented anywhere (at least not well), so at best, it was a lot of guesswork, held together with duct tape and number 8 fencing wire.