Create pipeline along with builds in the transation
## What does this MR do?
This MR makes it possible to create pipeline along with all associated builds in the transaction, to avoid having empty pipelines when asynchronous job gets terminated.
This will simplify implementation of `PipelineUnlockWorker` in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6988 and improve reliability of the CI as a whole.
## What are the relevant issue numbers?
Related to #24361
See merge request !7742