No, the G17 and G19 barrels have smaller outer dimensions than Glock's .40 barrels. The smaller 9mm barrels may gouge the sides of the breech face of the slide, and because the part of the barrel that sits in the muzzle hole of the slide is smaller, much more stress would be put on the barrel lugs, locking block, frame pins, and the frame itself.I would assume that I would have to get a G17 barrel and mag for the G22 and for the G23 I would be swapping in the G19 barrel and mag.
For the Gen4 G22 you would need to get an aftermarket .40-9mm conversion barrel for the G22, and use G17 magazines. For the Gen4 G23 you would need a separate .40-9mm conversion barrel for the G23 along with G19 magazines. You cannot use the same barrel for both guns, each gun uses a different set of barrel lug dimensions.
Also, the crescent-shaped cut-out on the barrel lug that the base of the guide rod seats into is different between Gen3 and Gen4 barrels. That cut-out is smaller on Gen3 barrels, and most aftermarket barrels have this smaller cut-out as well. So you need to be sure every time you reassemble the gun from field strip, even if you didn't take the barrel and guide rod out of the slide, that you fully seat the base of the guide rod into that crescent-shaped notch in the barrel lug.
You shouldn't have to change them, but the 9mm Gen4 models use lighter springs. In Gen3 and earlier, the 9mm and .40 models used the same springs. In Gen4 after so many revisions of the guide rod assemblies, Glock settled on weaker springs for the 9mm models. I'm not sure what weight each set of springs would be.I also assume that I could just leave the guide rod and recoil spring alone.
If you want to get the lighter-sprung guide rod assemblies, many online retailers sell them and one of your local gun stores may have them. You would use the Gen4 G17 guide rod in your Gen4 G22 with the 9mm conversion barrel, and the Gen4 G19 guide rod in your Gen4 G23 with the 9mm conversion barrel. Here's a chart showing what number markings are on the base of the latest version of each guide rod: