Presumably, this food is for eating. Because there are soooo many good reasons to bringing own food onboard to eat, instead of succumbing and paying for something three times more than it should.
Did you know that at JFK it is possible to shell out $6 for a pack of dry, grocery-store ramen? 🙄
In an ideal world, we'd be able to squeeze our lunch into our carry on, but every inch of space is precious. The quick answer is that yes, if you choose to hold it separately, it will technically does count during the carry on limit; however, in our experience, we have never been called out on it passing through security.
There's a ton of anecdotal evidence out there as well that having a carry on, personal item and lunch bag isn't enough to get in trouble—airports are busy places. However, that doesn't mean TSA can't call you out on it.
(That's also with us bringing a pretty conspicuous lunch bag each and every time.)
Besides, the worst case scenario chunking it in the trash, and then, well, having to go buy some overpriced airport food.
Since we're on the topic, liquid food items like soups and sauces over 3.5 ounces (100 mL) have always made it past fine from our experience. However, they are generally not recommended more for the potential-for-things-to-go-south-mess factor than for the security factor (also personal experience).
In general, airline food is composed a little bit differently from food cooked on the ground. Our tastebuds literally process things differently 30,000 feet up in the air—so airlines often need to concentrate and double up the amount of sodium and umami in order for it to taste anywhere similar than it would taste on the ground. Meaning it's also not the poster child for health.
It's not a perfect answer, but hopefully, it at least somewhat answers the question.