This is much easier to solve in CentOS and RHEL than building new tools. Redhat has done this for you. If you are a developer and need newer build tools, enable the SCLO repo.
yum install centos-release-scl && yum install devtoolset-9
Or devtoolset-8, whichever has the versions of tools you need. Then in your build script or global environment script, use PATH="/opt/rh/devtoolset-9/root/bin:${PATH}"
scl_source enable devtoolset-9
To get an idea of what versions of tools are in which devtoolsets, visit a repo mirror [1].[1] - http://mirror.centos.org/centos-7/7/sclo/x86_64/rh/Packages/...