Fix data race in TestDockerCommandBuildCancel
What does this MR do?
Fixes data race in TestDockerCommandBuildCancel
Why was this MR needed?
Thet test would sometimes fail the pipelines
What's the best way to test this MR?
What are the relevant issue numbers?
Closes #25594 (closed)