(1) only lube the inner chain, and get excess off. The rest is dirt (as you said).
(2) it’s nice to lube other parts as well just that it’s smoother. Additionally if desired, use a cloth to get excess off.
I use some kind of dry lube and it dries up on my chain. So I have the feeling it doesn’t really “lube” the cassette when I shift into a gear. So I do shift through the cassette but then take the excess off.
I use a waxed chain, and I do shift through all the gears simply to make sure that everything still works. For me, a fresh wax job on the chain is accompanied by disassembling the cassette and cleaning in the ultrasonic machine, it just (to me) seems reasonable to make sure I hit all the gears and confirm I assembled everything properly.
In other words, it has nothing to do with dropping wax or lube onto each cassette cog… it’s more a validation that I didn’t mess something up along the way.
I would say that shifting will slightly twist the chain and as such allow greater penetration into the rollers but as noted any oil or lubricant on the outside of the chain or on the sprockets is just a dirt magnet