Fruits act to facilitate seed distribution - you have probably heard of the so-called 'constipated bird theory' of seed distribution.
Example: Arceuthobium spp, mistletoes that infects pines and cedars in N America, have small white fruits that contain a single seed. The seed has to pass through a bird's digestive tract before it will germinate. Digestion also activates a sticky, gummy resin on the seed surface that holds the defecated seed in place - if it is lucky enough to have been dropped on a susceptible gymnosperm tree.
Bitterness (Saponin) is a sort of a biochemical byproduct that usually relates to "pest control". In the case of squash - e.g., winter squash - that do not have physical damage from bugs or fungi, will dry and form a harder ball, which acts as a seed time capsule. You can do this at home - wash a blemish free acorn squash in a borax solution - in the US '20 Mule Team Borax' is available. This kills off any surface fungal spores. The hardball squash will last for years. This is the same idea with gourds which are the easiest curcurbit to dry and turn into a hard ball. No borax needed in the wild.
The "reason" for the time capsule thing - wild squash require seed stratification(cold period) to germinate.
Since the seeds do not survive animal digestive tracts, and need to get cold exposure, a time capsule is good safe long term storage. Bare seeds on the surface are more likely to be eaten. Alternatively, an animal like a ground squirrel can bury the seed, also good. Either way, the seed is kept safe during the cold season, and survives until once again gets some warmth and moisture. So if vertebrates stomp the dried capsules -> voila, more squash plants. Getting buried seeds to the surface is a lot more iffy. So. Some seeds will germinate as deep as 12 cm - see link below.
This is a very interesting link about stinky melons which are roadside plants here in New Mexico. My neighbors on the reservation made rattles, bowls, and soap from them:
https://en.wikipedia.org/wiki/Cucurbita_foetidissima
Since most curcurbit seeds need a dormant cool period the fruits themselves do not provide nutrition, only "pesticides" and allelochemical compounds.
https://en.wikipedia.org/wiki/Allelopathy
"pesticide" concept related to allelopathy:
https://en.wikipedia.org/wiki/Plant_defense_against_herbivory
@BillTre - that should give you what you need to get an idea about plant reproductive strategies. The word strategy may imply cognition, but in this context there is none. Plants do not think. Period.