'A book is not [always] a good book just because it is written by a famous writer.' is fine: grammatical and idiomatic.
Collins Cobuild explains this well, though I'd say the expression is not formal (ie would be out of place in only the most formal of contexts) rather than informal:
just because phrase [informal, spoken]
You use just because when you want to say that a particular situation
should not necessarily make you come to a particular conclusion.
Just because it has a good tune does not mean it is great music.
Just because something has always been done a certain way does not make it right.
I do not have any rights just because I have been here a long time. [The Sun (2016)]
[which could have be written, with a slight change in focus]
Just because a person has been here a long time does not mean they [always / automatically] have rights.
It is understandable to worry about the possible ambiguity; without the 'always' or 'automatically', 'A book is not a good book ...' and 'I do not have any rights ...' are garden-path lead-ins. But the 'just because ...' is recognised as adjusting the meaning of
'A book is not a good book ...' / 'I do not have any rights ...'
'It would be wrong to assume that a book is good ...' / 'It would be wrong to assume that any rights that I have are mine ...'.
But the sentence
It is hard to determine if a book is good just because it was written by a famous author.
while an obvious (but unnecessary) attempt to address the surface-level ambiguity, does not work. You need say
It isn't safe to assume / state that a book is good just because it was written by a famous author.