I think you're overreacting. It's not "mandatory attendance." It's "our class is going to the book fair today, please stay in a single line."
Which is worse? Telling your five-year-old that, while she may browse, you don't intend to purchase anything OR having her sit in the classroom unattended or sent to some "alternative" activity because "her parents don't want her looking at books?"
There's a lot of things to be concerned about in public schools.
Book fairs aren't one of them.
Here's an idea: Don't do them at all.
When they ask us about fundraisers, I ask them where they spent the money they take from me in taxes. After a few years, they quit asking.