Environment deployments are indeed async. Please check this part of documentation. So in case of environment deployments after_deploy script runs after deployments started, but in case of inline deployments after_deploy script runs after deployments finished.
If you have some special reason to use environment deployments during the build (for example you need Agent deployment) can use our API to start deployment and check if deployments finished. Please look at this sample.
If this is not exactly your case, please describe your scenario more.