I think the correct fix for this would be to parse the CPU topology info out of the [`kern.sched.topology_spec`](https://man.freebsd.org/cgi/man.cgi?query=smp&sektion=4&manpath=Free...) sysctl, unfortunately it’s XML. Using the built-in [bsdxml](https://man.freebsd.org/cgi/man.cgi?query=libbsdxml&apropos=0&sektio...) library (a renamed expat) would likely be the easiest way to do that without adding an XML library or dependency on an external one.
I’ve been meaning to give this a try, but probably wont get to it until next year.