>>I did also wonder if we should be changing each of the event register
>>callers, or doing something inside the event register function instead?
Thanks again for your suggestion, it was the right way to go that solved the inconsistency with bb_diskmonitor event handler (and any other that would be registered manually, without addhandler statement). I prepared the change and it does not trigger any errors. I tested it with:
$ bitbake-selftest
$ oe-selftest -r multiconfig,
$ oe-selftest -r buildoptions.DiskMonTest.test_stoptask_behavior
$ yocto-check-layer-wrapper ../meta-mingw
$ bitbake core-image-sato:do_testsdkext core-image-minimal:do_testsdkext core-image-sato:do_testsdkext (only for qemux86-64, one of the machines that was failing)
which are the tests that failed with previous patches and now all tests passed.

Please check the next patch:
https://lists.openembedded.org/g/bitbake-devel/message/12020

Best regards,
Tomasz Dziendzielski