That's what this law does though.
Only because the government wrote laws to allow them to do that. Government always seeks to expand power. We are incredibly far astray from our Constitutional Rights.
I can see a day in the future when a court must decide if the bible forbids baking a cake for a gay couple.
No, the court would have to decide if forcing the baker to make a cake placed an undo burden on him or her which outweighed the public interest.
According to the law, the court can decide if someone's religious objections are valid. Therefore the court will need to determine if baking a cake is forbidden by a religion. As far as I can tell it is not forbidden by any religion.
Baking a cake is, as you pointed out, and quite probably, not forbidden by any mainstream religion.
However, decorating a cake, with particular imagery, may very well do just that.
And, of course, associating with Evil-Doers or Sinners may very well be forbidden (or strongly discouraged) by a variety of belief-systems and sects and offshoots.
Very few folks are likely to object to the baking of a cake.
But...
Decorating a cake with objectionable imagery? Not so certain.
Associating with Evil-Doers? Not so certain.
Participating in an event featuring Evil-Doing? No so certain.
And it's those three latter issues, which form the basis of the objection, yes?