Opening the book…
Rebuilding per environment means test verified one binary and prod runs another. Everything between build and prod must be configuration, not compilation.
One build stage publishes the artifact; deploy stages consume it. Anything environment-specific arrives via variable groups or app configuration at deploy time.