The rxvt family and maybe more use it for another purpose (they do not support true color). So, it was always "unreliable". It may as well always have been a `NIMTRUECOLOR`. I agree a way to statically override may make sense (maybe statically override the name of the var as well?).
The best way (at least in the world of esc seq controls) doesn't really exist. I think it would be a special escape sequence to query everything a program might want to know about the terminal - both capabilities and current states. Then the source of information would be authoritative for said information. But the world evolved a different way from this. So, this is not a viable road to terminal portability. It also bears mention that most sets of users disagree enough on color schemes/themes (night mode, etc.) or even color at all that a per-user config file override may also make sense. I happen to have a setup with both white background and black background terminal emulators and I key configs based upon an `LC_THEME` environment variable (transparently propagated by sshd until recently). (See [lc](https://github.com/c-blake/lc) for examples), and `cligen/humanUt` also supports using true colors in the xterm/st/alacritty/kitty family of true color esc seqs. So, that set up may also be useful to you. (The whole esc seq generation system is under 60 lines of Nim and you might also just do your own...)