If Amazon started saying "we won't sell these books to gay people" then, yeah that would be a problem.
Say a baker hand-makes dog-shaped cakes, among other cakes. The baker loves dogs. A client comes in and tells him he hates dogs and wants to order a cake for the purpose of ritually defiling it.
Would the baker be wrong in refusing to fulfill this order?
Legally, the baker would not be "wrong" in your scenario, though in my opinion they would at least be foolish. Defiling a cake does not harm a dog and once the customer pays for, it is their property to do whatever they want with.
How about if your dog-hater were driving late at night, they got tired and pulled over into a motel. They're signing in for a room and the topic of dogs comes up for whatever reason. They mention that they hate dogs and the motel owner says "Get out, we don't allow no dog-haters in here". Are they right to do that? Legally, again, they could, though they couldn't on the basis of sexual orientation (in some states) or race, religion, national origin (everywhere).
The Supreme Court has already sided with the baker on the basis of the cake being an artistic expression, so it's a moot point now.
https://en.m.wikipedia.org/wiki/Masterpiece_Cakeshop_v._Colo...
"Masterpiece's owner Jack Phillips, who is a Christian, declined their cake request, informing the couple that he did not create wedding cakes for marriages of gay couples owing to his Christian religious beliefs, although the couple could purchase other baked goods in the store. "
It was not even a question in the lawsuit that a pre-made cake would have been an acceptable substitute.
I said "most people" because I'm sure there are people who have less formal, low-budget weddings where they grab any old cake from the grocery store. That is not what is understood when someone says "wedding cake".
Forced creation is as bad as forced speech.
Not to mention, there's no need, as a customer, to inform the baker the purpose of the cake. Doesn't matter if you're taking it to a wedding, or using it as a prank. They make cake, you want cake.