Such studies do exist - randomized feeding trials. In these studies the participants are provided all meals and snacks, and sometimes are under constant surveillance for weeks and sometimes months on end.
https://pubmed.ncbi.nlm.nih.gov/39134209/
Obviously such studies are far more invasive and expensive to run than the classic "fill out of a survey" observational study [1], so they tend to be the outliers. But they exist and have incredibly useful results.
[1] There is a widely cited nutritional survey vehicle called the Nurses' Health Study, and it is the foundation of countless largely disposable nutrition clickbait results. This survey-based observation has been used to prove that meat is bad for you, and good for you. That artificial sweeteners make you thinner, and fatter. And on and on. That single "every now and then try to remember the kinds of things you ate over the past period of time" survey is the root of an incredible amount of noise in nutrition science.
How about just pointing a camera at the bed and fast-forwarding to the few significant events each night?
The study you point to here is a guideline on conducting studies. It was unfortunately not available online so I can't evaluate their recommended methodology. Looking for actual studies that tried to do randomized feeding trials, I found "A randomized controlled-feeding trial based on the Dietary Guidelines for Americans on cardiometabolic health indexes"[1] as a top hit, which fortunately had the full text [2] available.
Randomized controlled-feeding sounds good, let's check it out. After trudging through this for a bit I came to the meat of the methodology:
> Participants were provided a daily meal checklist (Supplemental Figure 1) that included each menu item with space for documenting the amount consumed; the time each item was consumed; a checkbox to confirm having only eaten study foods; a checkbox to confirm not taking any medications, supplements, or other remedies; space for documenting any adverse events related to eating the meals; and space for documenting any nonstudy foods, drinks, medications, supplements, or other remedies. They were also instructed to return all unwashed packaging; visual inspection was documented by the metabolic kitchen. In addition to the checklists and returned packaging, participants were educated on food safety as well as provided tips on managing challenging social situations while participating in a feeding study. Repeated reinforcement of the value of honesty over perfection was provided. Study coordinators reviewed the returned checklists with the participants to verify completeness.
So ... self reported with some extra steps.
[1] https://pubmed.ncbi.nlm.nih.gov/30101333/
[2] https://www.sciencedirect.com/science/article/pii/S000291652...