Add a few missing includes, remove two unnecessary ones and use __cstddef/size_t.h instead of <cstddef> in a few places. This is a collection of miscellaneous findings that collectively unblock other modularization patches.
This moves a utility from `<tuple>` into an implementation detail header and refactors the selection of the variant index type to use.