The ancient pre-Buddhist religions apparently did involve animal and even human sacrifice. This has gone into the iconography of Tibetan Buddhism with gruesome images.
There is another historical background also, the idea of meditating in charnel grounds. There - this is something done in Tibet also - a charnel ground is a place where dead bodies are disposed of, common in both India and Tibet.
In Tibet then - well the very highest status burial is cremation - used only for highly respected teachers. Their bodies are burnt in a low temperature fire to preserve the bones as relics.
Apart from that, the highest status burial is "sky burial" in many parts (remember Tibet is a diverse country with many different local customs). In this, the body is hacked up after death and then left out for vultures to eat. This seems gruesome to Westerners - but in the cultural context, this both helps the individual to move on to their next life - and also it is generosity offering their bodies to the vultures.
So - much of the iconography is to do with this sky burial. Yogins would make cups out of skull caps. Similarly to the way skulls were often represented in Western paintings in the past.
Aelbert Jansz van der Schoor Vanitas Still Life (Skulls on a Table) 1660 Copyright Rijksmuseum Amsterdam
It's a similar idea - reminds us of impermanence and death, and that this life is not all that there is, and that we might die at any time.
Which in Buddhism, as with Christianity in these early paintings - it is a positive message. Encourages us to use this life in a positive way and to value what we have, by being alive, and able to listen to the teachings and practice the path.
So in the same way - some yogins in Tibet (depending on the practices they were doing I imagine) would use human skull caps as drinking bowls in their rituals, and also wear robes made of skin that they took from bodies in charnel grounds, as a constant reminder of death and impermanence. Same tradition also from India.
You also have the idea in some of the practices of offering your own body, in this lifetime, as a sacrifice. So the human sacrifices of the past get turned into symbolic sacrifices of the yogin himself or herself. I'm not sure how that works exactly - but in general terms anyway - it is to do with offering oneself with all ones imperfections to the path - not to any external deity, but to the process of realization and understanding and opening out to others.
So ancient shamanistic ideas of sacrifice, in Tibetan Buddhism especially (but already present in Buddhist practices in ancient India) - become this idea of opening yourself out to the path, shown with particularly vivid images in the iconography of death, destruction, and general mayhem that is easily misunderstood if you don't have the background explained to you.
Basically it is to do with understanding impermanence, that things change, and that you can't fix things permanently. That though you can find happiness for long periods of time, none of us can build a permanent beautiful home in Samsara by our own efforts that will be ours for all time. So the only realistic thing to do in the long term is to recognize this. And that the Buddha taught a way to work with this, which involves, amongst other things, opening out to others and becoming more aware and in tune with the situations around us. Which can then lead us to be able to relate to the many changes that are inevitable so that instead of seeing them as purely destructive, destroying all our attempts at fixing our present situation and creating stability, can be something that is part of the entire process we are also working with ourselves.