Grief over death of loved ones is not adharma but avidya born out of identification with body and failure to realize Self. To eradicate this grief of death, diseases, old age alone, Buddha(than King Siddhartha) left kingship and accepted monkhood and found peace only after enlightenment. Avidya was explained in Geeta Chapter 2
BG 2.11 The Supreme Lord said: While you speak words of wisdom, you are mourning for that which is not worthy of grief. The wise lament
neither for the living nor for the dead.
BG 2.12 Never was there a time when I did not exist, nor you, nor all these kings; nor in the future shall any of us cease to be.
BG 2.13 Just as the embodied soul continuously passes from childhood to youth to old age, similarly, at the time of death, the soul passes
into another body. The wise are not deluded by this.
Now an animal lacks intellect and can never read or understand Shastras or Self, so its pointless to compare humans at same level of animals. Perfected beings like Rama, Krishna, Janaka, sages etc., manage to establish in the Higher Self in all conditions and do their body activities which becomes Karma Yoga.
BG 5.7 The karm yogis, who are of purified intellect, and who control
the mind and senses, see the Soul of all souls in every living being.
Though performing all kinds of actions, they are never entangled.
BG 5.8-5.9 Those steadfast in this karm yog, always think, “I am
not the doer,” even while engaged in seeing, hearing, touching,
smelling, moving, sleeping, breathing, speaking, excreting, and
grasping, and opening or closing the eyes. With the light of divine
knowledge, they see that it is only the material senses that are
moving amongst their objects.
This can be understood through analogy of Tree of Jiva and Atman of Rigveda as well. Thats why Krishna was equanimous when Gandhari cursed destruction to Yaduvansha, or when Dwarka submerged or when he was hit by arrow of Jara. Thats why people are told to worship perfected beings like Rama, Krishna etc., as what one thinks or worships, one inherits the character of that personality (Law of Attraction)
About Krishna's emotions part, its explained
BG 12.19 Those, who are alike to friend and foe, equipoised in honor
and dishonor, cold and heat, joy and sorrow, and are free from all
unfavorable association; those who take praise and reproach alike, who
are given to silent contemplation, content with what comes their way,
without attachment to the place of residence, whose intellect is
firmly fixed in Me, and who are full of devotion to Me, such persons
are very dear to Me.
BG 12.20 Those who honor this nectar of wisdom declared here, have
faith in Me, and are devoted and intent on Me as the supreme goal,
they are exceedingly dear to Me.
Ofcourse a human prefers company of another human, a dog of another dog etc., similarly a perfected being would like company of another perfected being or someone striving to be one and in Dharma, thats why Arjuna was dear to Krishna but not Duryodhana.