If your ex gets to live for free and have you cook for him, why would he ever leave? Yes, he did a big favor for you in the past, but how long can he get a free ride off of that? And his actions now are downright disrespectful and unacceptable for someone freeloading. It sounds like your big heart may actually be enabling him. Even if you care for him, be sure to push back when he acts like this. It will make him a better person. It’s good for him to learn how to behave like a responsible adult.
But just based on the living arrangement with all those people, it might make sense to come up with a system so people know which foods are reserved versus what’s available to take. Someone could very easily eat something as a snack that you need to use for dinner. A simple way could be to put rubber bands on things you don’t want people to eat. It makes it very clear what they should not touch and will help avoid these situations in the future.