I can appreciate the nuance of the situation, and I am being very black and white in my explanation but this is an issue of freedom. I do understand how it may seem appropriate to protect the baker's religious freedom on this issue. However, the customer's is equally important. It is unreasonable (in my opinion) to expect a consumer to conform to hitherto unknown religious guidance before purchasing pastry (or anything else, obviously).
It is not unreasonable (again in my opinion) to expect a commercial pastry company licensed in a secular Nation to bake and/or sell product to people who do not conform to their religious ideals.
The loss of freedom in this case seems black and white to me. The baker is in the wrong. I will fight for his right to put a big 8 foot bloody Jesus on the cross in the parking lot of his store but he can't deny legal tender based on someone else's religious difference.
Let me be clear. It makes absolutely no difference what religious persuasion the transgender person is, it is obvious that religious persuasion sees no negative connotation to transgenderness. Thus, refusing service based on the baker's personal religious preference is in effect discriminating against the religious preference of the customer. The baker of cakes gets to bake cakes regardless of the customers religion, but the customer is left cakeless specifically because of their religion.