To fix T8126 this filters blocking/blocked tasks to include only open tasks at join time rather than after joining, then counts the number of such tasks after grouping.
This should be about as performant as the current implementation (with the benefit of also working), however, I doubt the MySQL optimiser is smart enough to realise we're only counting tasks and comparing with zero and it therefore can stop after finding the first open blocking/blocked task. Consequently, refactoring this to use EXISTS subqueries with a LIMIT clause may give a performance boost. Let me know if you'd like me to attempt that.
And of course, let me know any other direction you'd like me to go with this.