I had a pineapple for lunch
I had pineapple for lunch.
These are examples of the difference in English between measuring the number and the amount of various things. A pineapple means one, whole pineapple -- a countable number. Pineapple (without the article) means some amount of pineapple -- a bowl, a cup, a scoop, etc. -- in other words, some uncountable quantity.
So either "a pineapple" or just "pineapple" is fine, depending on what you mean.
Meanwhile, "soup" is uncountable, so you can't have "a soup". Instead you would have instead some amount of soup for lunch -- a bowl, a cup, a liter, etc.
I had soup for lunch
I had a bowl of soup for lunch
Lastly, "apple" is like "pineapple" in that it can be either countable or uncountable.
I had an apple for lunch
If you put apple in your kale smoothie it tastes better.
"Chocolate" is uncountable, so if you want to specify a number you have to use some countable modifier -- "a bar", "a piece", "a cup".
After lunch I shared a bar of chocolate with my coworker.
More on countable and uncountable nouns