First things first:
The concept of "grammatical mood", like the concept of "word", is one of those things that works great within a language (as a tool to make a particular theory/explanation more elegant) but kind of breaks down when applied cross-linguistically.
For example, some languages have tense, aspect, and mood being orthogonal axes, where any given verb can choose one of each. In Latin, you can mix and match however you like between [present|past|future] [imperfective|perfective|aoristic] [indicative|subjunctive] (*).
In other languages, tense, aspect, and mood are combined into a single marking, and you can only choose one. In Lingála, "present", "recent past", "gnomic", "habitual", and "subjunctive" (†) all take up the same slot: every verb gets one and only one of them. Sometimes this combination is called a "TAM", short for "tense-aspect-mood" (or "tense-aspect marking" if mood isn't included).
Sure, you could break down the Lingála TAMs into tenses, aspects, and moods: recent past is a tense, habitual is an aspect, subjunctive is a mood. But it just isn't particularly useful to do so, since they're all mutually exclusive. You can't create a subjunctive habitual, for example, even though semantically "if I did this over and over" isn't nonsensical or anything.
In still other languages it's a mix: Ancient Greek mixes mood with tense (indicative can co-exist with any tense, but imperative, subjunctive, and optative are mutually exclusive with tense marking), but can mix and match moods with aspects to your heart's content.
Now, to get to your actual question…
Whereas when you are having a sentence about objects like "The cat climbed up the big tree to eat its catch", the objects are typically separate…
Many languages incorporate the subject into the verb: Latin tē amō "I love you" versus tē amat "she loves you", for example, has descendants all across the Romance languages.
Many others incorporate the object into the verb as well: Swahili nakupenda "I love you", unapenda "you love me".
Some languages take this to extremes: Rwanda aranahakizibakun-someesheesherereza "she is also making them read the book, using the glasses, to you, for me, in the house" (‡).
Other languages have agglutinative morphology, where a huge number of morphemes can be combined into a single word, with morphology taking over the job of syntax in other languages: Inuktitut Parimunngauniralauqsimanngittunga "I never said I wanted to go to Paris!" (§).
But anyways, another thing that factors into this is that it makes a lot of sense to have the count or the tense be a modification of the word base.
Why those things in particular?
Why the count but not the gender (Latin amīcus "friend (m)", amīca "friend (f)"), the size (Swahili nyumba "house", chumba "room", jumba "mansion", ka-umba "apartment (dialectal)"), the general type of object (Swahili Mswahili "Swahili person", Kiswahili "Swahili language", Uswahili "Swahili-ness")?
Why the tense but not the aspect (Ancient Greek epaídeusa "I taught (in the past)", epaídeuon "I taught (in the past, repeatedly or for a long time, what's important happened during the duration)", epepaideúkē "I taught (in the past, it was completed, what's important are the aftereffects)"), or the evidentiality (Turkish geldi "he arrived", gelmiş "I heard that he arrived"), or the polarity (Japanese amegafutteiru "it's raining", amegafutteinai "it's not raining")?
The choice of what to incorporate into the morphology, and what to give to the syntax instead, is pretty much arbitrary. Mandarin has basically no verbal morphology at all, relying on syntax and additional words for all of these. Inuktitut uses morphology for all of them, requiring syntax and extra words for basically nothing!
Modern English is somewhere in the middle of the road, but closer to the Mandarin side: we use verbal morphology to indicate past vs non-past, and third person singular versus everything else, and that's it. But that's just English; other languages do it differently.
I want to know some reasons why languages make these word modifications, rather than separate words, because it seems so much less efficient from a computer-science standpoint…
Not at all!
From an information-theory standpoint, all that matters in the end are the bits. Some languages use fewer words, but more bits of information per word (since there are more possible words). Other languages use more words, but fewer bits of information per word.
In the end, as a recent study showed, it all evens out. Some languages have more bits per word, some languages have more bits per syllable, but in the end, the fundamental rate of information transfer is always right around 39.15 bits per second. It seems like this is a sort of fundamental limitation of human biology, and languages will evolve to reach it, by whatever means necessary—there's tremendous selection pressure being applied every second of every day, after all!
Over time, languages evolve in different directions. Romance dropped a whole lot of Classical Latin's morphology, using extra words instead. Then it incorporated some of those extra words into the verb, turning them into affixes. Modern Romance languages use a mixture of both. The exact details seem to come down to the vicissitudes of fate—which indicates that the different options are about equally useful for communication, and the choice of one or the other comes down to historical accident more than anything else.
(*) Morphologically, not all of these forms are completely distinct: the future subjunctive looks like the present subjunctive, the present perfective looks like the past aoristic, etc. But you can still mix and match freely, and Vulgar Latin took steps to separate out the ones that got too ambiguous (such as the present perfective ~ past aoristic combination).
(†) And more! Different authors list different numbers, but in my own work I've separated out thirteen morphologically distinct TAMs.
(‡) Example taken from Kimenyi (2002).
(§) Example taken from Mallon (2000).
Apart from those, all examples are my own. If there are errors in them, blame me.