It's really a complicated topic... About the initial discussion concerning melons: It was intended that you cannot stack watermelons (only melonslices). The reason behind this is quite simple: When using the secondary mouse button, you cut the melon into slices, which simply exchanges the item in your active slot (the watermelon) by 8 slices. When watermelons would be stackable, this mechanism would not work.
Apart from that, we don't want to have too high stackcounts for food, just to avoid that you are able to carry enough food for the next years On the contrary, when it comes to blocks or resources, it would hurt too much when you can't stack them or when you can only carry small stacks.
Realism is anyway complicated, since the whole inventory thing would only make sense for very small items (compass, eventually bacon etc.). Bigger items don't fit into my pocket (even 1 single block would be too large), and I would also run into massive problems when I have to carry things like pianos or furnaces at all...
Maybe the restriction of stacksizes would make sense for the stranded mode, which could be considered as a "hardcore survival" (maybe a "hardcore" option would also be useful for the regular survival), which is intended to focus on survival instead of building (or in other words: you only build to survive).