Your sentence structure does not just say "a/the book was bought yesterday" (in which case "the" might well be appropriate), it uses book I bought yesterday as a noun phrase to be the object of the verbs in the sentences.
The use of the definite article implies that the noun or noun phrase following it is sufficient to identify a specific, unique instance of it to the listener.
The noun phrase "the book I bought yesterday" implies that only one book was bought yesterday - describing the book as being bought yesterday is sufficiently unique to identify which book is being referred to by using the. If you bought more than one book yesterday then you can't use "the", you can only use "a", because "book I bought yesterday" is not a unique identifier.
It is not usual practice to introduce a piece of previously unknown information to the listener using a description in a noun phrase with the definite article. You can use descriptive information that you know or can assume that the listener knows (e.g. colour, size or spatial location) to uniquely identify an object and therefore use the. However, if you can't assume that the listener knows the information, it would be confusing to include it in an identifying description. Therefore, if the listener didn't already know you had bought a book yesterday, even if you had only bought one book, you shouldn't use "the book I bought yesterday". Adding the sentence "I went to the bookshop yesterday." before either of your example sentences would make them valid and clear when using the (if only one book was bought) because it introduces the information that books were bought before using it to identify a particular book.
As you are holding/showing the book, you can refer to it as this book to clearly indicate a particular book. Alternatively, you can use "the" if you change the noun phrase to a unique description that the listener can identify, such as "book I'm holding", "book in my hand" or something similar.
If you had previously mentioned/implied the fact that you had bought some books yesterday (or been to a bookshop etc), then I would use the phrase one of the books, like so:
I have one of the books I bought yesterday with me.
This is one of the books I bought yesterday.
The books has already been established (hence "the") and you are showing an example of one of them. You can still use "a book" instead, but this is less specific in identifying the book. You still can't use "the book" because you bought more than one.
If no reference or implication has yet been made about buying any books previously then a sentence like this would make most sense to me:
I bought this book yesterday.
You are holding the book, so it is obvious what "this" refers to.
If no mention of books has previously been made, sentence A would be an odd one to say to someone; sentence B would seem the more appropriate sentence in the context, and you could only use it with the indefinite article.