> but according to this Wikipedia article, 'many programming languages
support conditional compilation', which I assume would allow them to
conditionally include libraries, depending on what sort of system they are
being compiled on/for.
Please do not make assumptions about how things work.
Compilation is building binaries. So if a program relied on compiler flags
for optional dependency on systemd, two versions of the binary would have to
be built. Apt (and other package managers that aren't e.g. Gentoo and Guix)
do not compile, they only install existing binaries. You would have to have a
foo package, and then a foo-nosystemd package. In practice, distro
maintainers wouldn't bother maintaining two separate versions of the same
program just so that it occupies a little less space on people's hard drives.
It's just like how Project: Starfighter supports being compiled without
SDL_Mixer, but why on Earth would Debian offer a non-SDL_Mixer version of
Project: Starfighter? So they don't.
See, if you understand these technical issues, you see that systemd is
optional with certain programs only because systemd makes it easy to do so.
If systemd did not provide a facility to detect if systemd is there at
run-time, then programmers would not bother to check at all and would just
make systemd a hard dependency.