Would it ever occur, historically, that a PhD student could not obtain his degree from a university due to the high costs of publishing his thesis, such that he would have to publish it at another university and get his degree there instead?
Emphatically, I don't see how this could happen in any subject in the U.S., nor, to my knowledge, in Europe, though I understand that there, in some cases, the actual work can be viewed as somewhat disconnected from a university.
But the point is that, in most subjects in the U.S., for example, one is not required to "publish" one's thesis in any fashion that would incur great expense. A handful of required copies, often printed nearly-for-free, and everything else is optional. Not "page costs" to journals, for example.
Further, in the U.S., it would be essentially impossible to "change universities" for any reason whatsoever, without re-doing many required activities, time-in-residency, and such. So whatever other advantages, there'd be something like a two-year delay, tuition, other things.
I really think that the question's hypotheses are iffy, possibly due to a misunderstanding of how things work. Certainly in the U.S., most likely in Europe, and I'd be surprised to hear that the questions implicit assumptions made sense anywhere in the world (though I'd certainly be interested to hear about such a thing).
Not that I'm aware of.
Obtaining a PhD consists of more than publishing a thesis/dissertation. How exactly could you do your work at one institution, and then graduate from another by simply publishing at another university? – SoilSciGuy just now edit