>>38129382They make the design first and then choose a type that makes sense for it.
They based Emboar on a Chinese soldier, so it got the Fighting type.
Though there's also a confirmed case of types being added or changed for the sake of type diversity. It was confirmed in a Nintendo Dream interview that Stunfisk was originally a Water/Electric type anglerfish before being changed to Ground/Electric for type diversity, and that the Frillish line were designed as pure Water types by their designer, but had the Ghost type tacked on after, also for type diversity.