well there's no reason why, containers can't just be a compiler + libc? Noone stops you from removing the GNU coreutils from your image or build your own. However I don't know if stripping these (a whopping 30MB for most Ubuntu-versions) is worth the hassle of dealing with a shell-less development environment.
I suspect it's similar to how building a C++ project works. In Visual Studio you select the minimum version you want to support and you're done. This in general is a pain point of Linux - the toolchain is set up for building the system itself rather than producing binaries for general distribution and there is no easy way to set up a generic toolchain for a given basic version of libraries. This is great for letting you modify your system, but it's not ideal for software development.
Installing an old distro via docker or in a chroot works, but I wish I could have just a compiler plus libc rather than an entire Ubuntu. I think Redhat allows something like that, but it should be more widespread.