Fix the ordering of transition callbacks:
Fix the ordering of transition callbacks:

Because pipeline status could be changed for the builds in the next
stages, if we process next stages first, the current build would be
out of synchronized, and would need a reload for that matter.

Alternatively, like what I did in this commit, we could process the
next stages later (by using `after_transition` rather than
`around_transition`), and complete what're doing for the current
build first. This way we don't have to reload because nothing is
out synchronized.

Note that since giving `false` in `after_transition` would halt the
callbacks chain, according to:

https://github.com/state-machines/state_machines-activemodel/blob/v0.4.0/lib/state_machines/integrations/active_model.rb#L426-L429

We'll need to make sure we're not returning false because we don't
intend to interrupt the chain.

This fixes #22010.

After this fix, both pipeline events and build events would only show
up once.

screenpages/gitlabhq,dreampet/gitlab,mmkassem/gitlabhq,openwide-java/gitlabhq,allysonbarros/gitlabhq,icedwater/gitlabhq,jirutka/gitlabhq,dreampet/gitlab,daiyu/gitlab-zh,icedwater/gitlabhq,t-zuehlsdorff/gitlabhq,allysonbarros/gitlabhq,shinexiao/gitlabhq,SVArago/gitlabhq,icedwater/gitlabhq,daiyu/gitlab-zh,screenpages/gitlabhq,stoplightio/gitlabhq,dplarson/gitlabhq,LUMC/gitlabhq,screenpages/gitlabhq,LUMC/gitlabhq,axilleas/gitlabhq,dplarson/gitlabhq,axilleas/gitlabhq,shinexiao/gitlabhq,openwide-java/gitlabhq,darkrasid/gitlabhq,dplarson/gitlabhq,allysonbarros/gitlabhq,openwide-java/gitlabhq,iiet/iiet-git,mmkassem/gitlabhq,openwide-java/gitlabhq,mmkassem/gitlabhq,daiyu/gitlab-zh,icedwater/gitlabhq,LUMC/gitlabhq,htve/GitlabForChinese,axilleas/gitlabhq,dreampet/gitlab,stoplightio/gitlabhq,stoplightio/gitlabhq,axilleas/gitlabhq,allysonbarros/gitlabhq,screenpages/gitlabhq,t-zuehlsdorff/gitlabhq,darkrasid/gitlabhq,t-zuehlsdorff/gitlabhq,iiet/iiet-git,darkrasid/gitlabhq,jirutka/gitlabhq,htve/GitlabForChinese,iiet/iiet-git,shinexiao/gitlabhq,htve/GitlabForChinese,SVArago/gitlabhq,jirutka/gitlabhq,SVArago/gitlabhq,dplarson/gitlabhq,dreampet/gitlab,jirutka/gitlabhq,daiyu/gitlab-zh,t-zuehlsdorff/gitlabhq,mmkassem/gitlabhq,SVArago/gitlabhq,shinexiao/gitlabhq,LUMC/gitlabhq,darkrasid/gitlabhq,htve/GitlabForChinese,stoplightio/gitlabhq,iiet/iiet-git