I have an Olympic Arms AR-15. Not only does it use the same caliber ammo as my Glock pistol, it also uses the same magazines!!
There are also AR’s that are .45 caliber that accept 1911 pistol mags.
Kel-Tec has the same kind of set up with their Sub2000 rifle. You can get them in 9mm & 40, and they have models that use Glock, Taurus/Beretta, Smith & Wesson, and Sig Sauer pistol mags.
Or you could just buy 2 of the same kind of handgun and convert one to a carbine.
The submachine gun is defined by its chambering in pistol calibers. The reason for such a weapon is that it will not suffer from recoil as severely as a handgun will, thus keeping the weapon on target, in addition to higher muzzle velocity and better performance due to the longer barrel.
It also had the added benefit of having the longarm and sidearm in the same calibers, eliminating the need to carry different types of ammunition for each, and in some cases both were capable of using the same magazine.
Of course, this depends upon whether or not you consider a submachine gun to be a rifle. I do.