Vias or traces through two pins of e.g. resistors on a PCB?
There is generally nothing wrong with routing between pads of components, provided trace width and clearance rules are followed. In fact, in many designs it is recommended to use 0 ohm resistors to jump one trace over another without needing a via to another layer.

In your case, as others have noted, you do not need to use traces for ground. It is preferable in that case to use vias directly to the ground plane/pour to minimize inductance. The same often goes for power connections, as well.