Apt socks5h proxy settings fail when specified on the command line

Apt supports HTTP, HTTPS and SOCKS5H (SOCKS5 with remote DNS resolution) proxies, according to both the source code and the man page, but when specifying the proxy values on the command line, apt reports that the proxy is unsupported:

root@host:~# apt -o 'Acquire::https::proxy="socks5h://"' -o 'Acquire::http::proxy="socks5h://"' update
Ign:1 buster-pgdg InRelease
Ign:2 buster InRelease
Ign:3 kubernetes-xenial InRelease
Ign:4 stable InRelease
Err:5 buster-pgdg Release
  Unsupported proxy configured: "socks5h://
Err:6 stable Release
  Unsupported proxy configured: "socks5h://
Err:7 buster Release
  Unsupported proxy configured: "socks5h://
Err:8 kubernetes-xenial Release
  Unsupported proxy configured: "socks5h://

Oddly enough, adding these same values to the config file:

root@host:~# cat /etc/apt/apt.conf.d/50proxy.conf
Acquire::https::proxy "socks5h://";
Acquire::http::proxy "socks5h://";

…results in a successful apt fetch:

root@host:~# apt update
Hit:1 buster InRelease
Hit:2 buster-backports InRelease
Hit:3 buster-proposed-updates InRelease
Hit:4 stable InRelease
Hit:5 buster InRelease
Hit:7 buster-pgdg InRelease
Get:6 kubernetes-xenial InRelease [9,383 B]
Get:8 kubernetes-xenial/main amd64 Packages [56.5 kB]
Fetched 65.9 kB in 5s (14.2 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
18 packages can be upgraded. Run 'apt list --upgradable' to see them.

Why there’s a difference between the two isn’t clear to me, since setting the option on the command line clearly reaches the appropriate code path, but it reports that the proxy is valid. The source code that checks the prefixes seems the same either way, and it simply checks for socks5h as a prefix, and then tries http and https, before displaying the “Unsupported proxy configured” message.

Oddly, this quirk doesn’t seem to be known online.