Historically this is just how it works. You want law x passed and I'm ambivalent about it, I want law y passed and you're ambivalent about it. We both need each other to pass either of them, so we agree to pass both as part of a larger law. This isn't a new thing and has been happening since the 1800s. As early as the decision to make DC the capital we've traded goals through compromise.
The process does get abused and I get frustration over those instance. For this one in particular, there are thematic similarities that can reasonably fall under "national security concerns".