Extract generated code from BUILD.toolchains.bazel into a macro (#3439)

As a macro, the code is cleaner and easier to reuse. In a follow-up
change, it will be used to simplify toolchain registration with Bzlmod.

This commit also removes the public `declare_toolchains` macro. It only
seemed to be public since it was accessed by the generated SDK repos. It
has never been documented and subject to backwards incompatible changes
in recent releases.
7 files changed