AITA for telling off the bag checking people?

I'm going through the security line at a museum and they are searching bags. They have these sticks to poke around or are just squeezing people's bags, obviously just searching for weapons. So I plop my purse down on the counter and one dude starts poking around and then the other guy grabs my bag and goes "I want to check it! I want to check it!" And they start this little tug of war over my bag...? So I say "why are you guys getting off on going through my bag?" To which the 2nd guy replies "ehhh we gotta have fun some how." So I just take my bag and enter the museum.
I told my boyfriend what happened, and he said my remark was snarky. Which I completely agree with haha. But was it inappropriate?

I know bag checking is a necessary security measure, but it's still a small invasion of privacy, and they are doing important work. I felt like someone doing that do that job should be at least a bit more professional.

But, I guess the biggest problem for me was the fact that 2 dudes were fighting over the chance to go through my bag.
Was I the asshole for making that comment?