I think they're fitted to the slides individually, at least that was the conclusion I and a gun shop owner came to many years ago. He had a NIB P89 with both 9mm and a .30 Mauser or Luger barrel and I owned a P85 or P89 at the time. (I had and sold so many Ruger P series pistols in the 90s that I get them mixed up.)
I offered to buy the .30 cal barrel from him and he agreed, but when we tried to put it in my gun it was a no go. The breech block that's fitted to the slide and ejection port just didn't fit together right.
Of course that's just a sample of one and they sell aftermarket pistol barrels all the time, so I'm probably wrong.