Good solution.
I'm late to the thread but my take on it is to do what you're doing. Attend (if you could have), just take the cookies that are nut free, and say no more about it.
I'm a pretty social person so any excuse to go to a party works for me. I was invited, a long time ago, to a cookie exchange party even though I'm Jewish (so therefore don't celebrate Christmas in any form). In addition to the cookie exchange the hostess requested everyone briing an ornament for a gift exchange. Well heck, you know, I don't exactly have any ornaments hanging around the house, nor do I need any. But what the heck, it's a party!
So, I baked my cookies, and bought an ornament and participated fully and had a great time. I went home with an ornament, which I later gave to another friend and ate up lots of yummy cookies.
So yeah. You go with the flow. Even if I couldn't take home any of the cookies, I'd still go, just for the fun of attending the party and socializing. But I definitely agree that it's not cool to ask the hostess to make a change that would affect everyone else she invited.
Asking for a nut free party? No.
Holding your own next time? Sure!