I don't think anybody was even thinking of porting any of
the *BSD to IBM mainframes till much later, am I right?
No. BSD was very much on IBM's radar in the late 1970s and 1980s.
Long before Linus released Linux into the wild in 1990 for the >>386<< much less any other ISA, IBM had been shipping as a product AIX/370 (and AIX/PS2 for the 386); which we developed at Locus for them. The user-space was mostly System V, the kernel was based on BSD (4.1 originally) pluis a great deal of customization, including of course the Locus OS work, which IBM called TCF - the transparent computing facility. It was very cool you could cluster 370s and PS/2 and from >>any<< node run a program of either ISA. It has been well discussed in this forum, previously.
A for AIX/370 a quick history which Charlie can fill in more from the IBM side, was that in the last 60s and early 70s, IBM had a strange hold on the education/research market with the S/360; but lost it because of the lack of timesharing to DEC and PDP-10 based systems as IBM was more and more focused on the commercial sector where there was much more money to be made. But ... there was a drive in the IBM educational/research team to be able to reenter that market and Locus was hired to develop AIX/370 (and later PS2) as it was felt that UNIX was considered an important offering for those customers. After it was released as a product, it turned out purchasing AIX/370 was exceedingly difficult (for a number of reasons), although it was extremely well received by those that ran it, but getting it was difficult. In fact, I have been told by folks that there at the time, that using TCF was an important feature here at Intel for the success of the simulation for the 486 and Pentium.
Again, Charlie can tell you the history but IBM also developed AIX for the RS/6000 which was the same OS (only different) from IBM Austin (no TCF, but supported DS which was cool in its own right). Locus was actually contracted to develop a UNIX subsystem for the AS/400 also, but I'm not sure if that ever shipped. I had left Locus and had gone to DEC by then.