Technically, both versions are possible and as stated in chirlus answer it is a matter of style. There are 3 things I want to mention though so I decided to make that an answer myself.
This refers to the style-part. Having the sentence being comprehensible is certainly one aspect but another one is balance. We always have a main sentence and that is preceded, followed and split by dependent sentences. The resulting construction should have some sort of balance.
That means for example that you should avoid putting 2 dependent sentences at the end if the first "slot" is available.
Nachdem ich gegessen hatte, habe ich mich hingelegt, weil ich müde war.
is better than
Ich habe mich hingelegt,nachdem ich gegessen hatte, weil ich müde war.
The first version is balanced, the second not so much.
Main sentence: -----------
vs. -------------, ______,_______
There is also a semantical problem with the second version but even without that .. distribute your dependent sentences as equally as possible. And for the example that means... don't split off one word of a moderatly long main sentence even if the dependent sentence is very short.
is preferable to this:
---------------------, __, --.
The second version is not balanced at all.
You shouldn't "delay" the relative clause if another dependent sentence follows because that might lead to semantical ambiguity.
Thomas hat gestern den Mann, der beim Bäcker arbeitet, angerufen, weil er Geld brauchte.
Thomas hat gestern den Mann angerufen, der beim Bäcker arbeitet, weil er Geld brauchte.
In the second version it is not clear what the weil-clause refers to. The first version is clearly the better one here although not nicely balanced.
The last example in the question made me realize another point. There has to be some force between the noun that is being specified and the relative-clause if you want to separate them. By force I mean something that binds them together and that is usualy the need for specification of the noun.
Ich habe gestern den Mann gesehen, der beim Bäcker arbeitet.
den Mann alone means nothing. It needs the relative clause to be precise. So there is something pending still which immediately pulls the relative clause to Mann as soon as we hear the pronoun... hence, a little delay is okay.
Things are different in this example:
Ich habe gestern Hans gesehen, der beim Bäcker arbeitet.
Though not wrong, I perceive this to be not really good style because there is not much of a need to specify Hans. The name gives me a pretty good idea of which person I have seen I don't need more info. So... I get my participle and I am waiting for nothing but then comes a relative clause. I will associate it with Hans but it is not completing anything for me so it is a bit boring. It feels like an afterthought, whereas the relative clause in the first sentence HAS to be there. So... in this situation I would actually say that one shouldn't delay the relative clause and say:
Ich habe gestern Hans, der beim Bäcker arbeitet, gesehen.
This is a bit unbalanced but not so much actually because the first part of the main sentence is not that long.
So in short:
- delay the relative clause is fine to get a nicely balanced text.
- don't delay it if it would then conflict with another dependent-clause that follows
- don't delay it if the relative clause is completely optional because then there is no force that pulls it bakc to its object