Your question was asked under our current scope and it is, strictly speaking, off-topic. The examples you mentioned are a thorn in our side as we have failed quite plainly too often to enforce this policy. It is therefore correct or let's say understandable that you are confused about this apparent discrepancy.
But you came to the right place to ask for clarification, here on Health.meta.
As @Narusan already pointed out in a comment:
This Meta Post explains why personal medical advice is off-topic. This rule has not been followed so strongly in the past (3 years is a lot on the Internet). Furthermore, we're in the process of changing the scope. But the bottom line: You have a question about a specific health problem you are experiencing, and no matter how you phrase it, this will be off-topic. Furthermore, it seems slightly irrelevant (and unlikely) that sleeplessness is correlated to eating right before, which is probably why it attracted the downvotes.
While I think that the amount of downvotes ended up as bit on the excessive side, I also think that you already found the recipe for improvement, partially:
if I removed the part asking what I should do, and reworded it to simply ask what I might plausibly be experiencing
As a proud owner of the informed badge, you've read the tour page. The next step is to read or re-read the [ask] page.
There it says:
How can I phrase it to address the health topic itself, rather than an individual situation?
Make it relevant to others
Search, and research before posting a question
And document your research on that, I might add.
Some still might think that this a mundane question not worthy of their attention or this site. I think this a quite common belief/conception or wide spread experience, so that under the current scope a generalised and well researched question – like this might become – it might then get an answer that is informative and generally applicable. So read up on our [help] what your own research reveals to you and edit your question. It's worth a shot.