I can reproduce the issue.
It's a bug. File a bug report. You can do that on OpenCV's github.
This existing issue report might match: https://github.com/opencv/opencv/issues/21786