Humpty Dumpty almost certainly wasn't an egg at conception
Humpty Dumpty is over 200 years old, originating in the 1700s.
Our first clue lies in the original phrasing of the poem; the eponymous Humpty Dumpty is not "put back together again" but rather
Four-score Men and Four-score more, Could not make Humpty Dumpty where
he was before.
This opens up both literal falling and political falling, while also lacking references to the king, as later versions would.
The first example of Humpty Dumpty being visually presented as an egg comes from Lewis Carroll's Through the Looking-Glass, wherein he argues semantics with Alice. The book, written in 1871, then popularized this personification of Humpty Dumpty -- and led to the "couldn't put Humpty together again" version; Alice specifically calls out the older wording as being "too long for the poetry" within the book.
In the 1700s, a "humpty dumpty" referred to one of two things: either a brewed brandy and ale drink or a short, clumsy person (E. Partridge and P. Beale, Dictionary of Slang and Unconventional English (Routledge, 8th edn., 2002)).
Were these the only things the phrase had been attributed to, one could easily conclude it was a morality tale against drunkenness (it was published in Mother Goose's Melody, after all) or a jab at a political figure (with most signs pointing to King Richard III, who had a great fall at Bosworth Field and was a known hunchback).
To further complicate things, there's also rumors of a siege cannon nicknamed Humpty Dumpty used to attack the English town of Colchester (specifically at St-Mary-At-The-Wall) during the English Civil War. All the Royalists couldn't put the cannon back on the wall after the section it was placed on was hit by cannon fire.
In summation, there's no signs that Humpty Dumpty was ever intended to be an egg at all, and the Lewis Carroll interpretation of the rhyme was so popular it stuck.