TL;DR Important due to both Particular Judgment and Purgatory
The form of the question.
Aren't we supposed to be judged by our whole life and not just what happens at the hour of our death? Should our whole eternity be based on what we did at the hour of death and pretend like our whole earthly life didn't matter?
As my answer will show, that isn't how it works. Your "pretend that it doesn't matter" is a False Assertion imbedded into the question.
The text of the question assumes an answer in the asking of a question (which means the question itself is fallacious in nature). It comes across in this way: (1) I don't know (X), (2) nonetheless it seems to be this way, (3) so why is it this way? This is not a well asked question anywhere, no less on an SE site.
Regarding the Hail Mary1
There are multiple questions answered on this site covering judgment from the Catholic point of view, to include this one here. In summary, the Catholic belief is that when you die you face particular judgment right then (CCC 1021). "When you die" is a time/event that can be called at the hour of our death if one chooses to use that turn of phrase.
It logically follows from Catholic belief that IF
- We are to pray for others (we are, see CCC Section IV, Prayer)
- And are praying for mercy (we may and should, see CCC, Section IV, Prayer)
- And Mary is believed to be an intercessor for us (she is)
- And in that office she may appeal to Jesus on our behalf (it is so believed)
- And that Jesus is the one who judges us (He does, Please See the Nicene Creed generally and amplified in the CCC2)
THEN it is perfectly rational to make a prayerful appeal for anyone that, upon their death, Mary will intercede and appeal to Jesus to be merciful in judgment upon that person (or collectively to be merciful upon all of us sinners) "at the hour of death" during particular judgment.
I. THE PARTICULAR JUDGMENT
CCC 1021 Death puts an end to human life
as the time open to either accepting or rejecting the divine grace
manifested in Christ. The New Testament speaks of judgment primarily
in its aspect of the final encounter with Christ in his second coming,
but also repeatedly affirms that each will be rewarded immediately
after death in accordance with his works and faith. The parable of the
poor man Lazarus and the words of Christ on the cross to the good
thief, as well as other New Testament texts speak of a final destiny
of the soul--a destiny which can be different for some and for others.
Each person is presumed to have sinned at some point in their lives, and thus at risk of damnation. Not only is that a Catholic belief, it's raw Scripture:
For all sin and fall short of the glory of God (Romans 3:23)
All are judged.
CCC 1022 Each man receives his eternal retribution in his immortal soul at
the very moment of his death, in a particular judgment that refers his
life to Christ: either entrance into the blessedness of heaven-through
a purification or immediately, -- or immediate and everlasting
damnation.
- At the evening of life, we shall be judged on our love. (~St. John of
the Cross, Dichos 64.)
About the Sacraments
There are other sacraments (confession, baptism, the anointment of the
sick) that guarantee salvation if performed in the hour of our death.
This is an oversimplification that misses the point of Catholic belief and practice. The one thing Christians do believe is that Baptism does indeed wash away sin, and Catholic belief goes further to aver that one is in a state of Baptismal Grace upon receiving the sacrament of Baptism. This state removes all sin to include the stain of original sin.
First: Baptism, from which the other sacraments follow.
Baptismal grace is necessary, indeed it is the precondition, for salvation.
Second: Confession. (CCC 1440-1460 The Sacrament of Penance and
Reconciliation).
Every time a Catholic goes to confession and receives absolution by completing the sacrament of penance and reconciliation, they are restored to the state of baptismal grace. That, in a nutshell, is the gift of this sacrament. The general teaching/rule is that a Catholic should be doing this at least once per year3. (This is often called "Easter Duty"). The encouragement to go to confession monthly is a common position taken by clergy. So no, you don't wait until "the hour of your death" to reconcile your sins if you follow the teachings of the Church. It's like car maintenance, but maybe better called "soul maintenance."
Third: The sacrament of the Anointing of the Sick CCC 1449-1532
Particularly for those near death, this sacrament combines three things when performed in full:
- Confession and Absolution (restoration of Baptismal Grace, see above)
- Healing / Blessing / Spiritual Strengthening
- Viaticum (Receiving the Eucharist)
Fourth: Purgatory
Purgatory is believed to be where any residual stain/effects of sin are purified/cleaned away so that the soul may at long last enter the presence of God, into whose presence no impurity may enter. Put another way:
Purgatory (Lat., "purgare", to make clean, to purify) in accordance
with Catholic teaching is a place or condition of temporal punishment
for those who, departing this life in God's grace, are, not entirely
free from venial faults, or have not fully paid the satisfaction due
to their transgressions.
Back to your question
Aren't we supposed to be judged by our whole life and not just what
happens at the hour of our death?
According to CCC 1021/1022 and the above, we are indeed so judged on the whole. IF, regardless of our receiving baptismal grace, making regular confession, and even receiving absolution on our death bed, we still have the residual stain of sin THEN we require further purification upon receiving our particular judgment, which occurs "at the hour of our death."
Put bluntly: No, it isn't like nothing else ever happened.
1Louis de Montfort made further comment on the risks to our souls at the hour of our death.
(Article 58. "Pray for us now," during this short life, so fraught
with sorrow and uncertainty; now, because we can be sure of nothing
except the present moment; now that we are surrounded and attacked
night and day by powerful and ruthless enemies.
"And at the hour of our death," so terrible and full of danger, when
our strength is waning and our spirits are sinking, and our souls and
bodies are worn out with fear and pain; at the hour of our death when
the devil is working with might and main to ensnare us and cast us
into perdition; at that hour when our lot will be decided forever and
ever, heaven or hell.
Come to the help of your poor children, gentle Mother of pity,
Advocate and Refuge of sinners, at the hour of our death drive far
from us our bitter enemies, the devils, our accusers, whose frightful
presence fills us with dread. Light our path through the valley of the
shadow of death. Lead us to thy Son's judgment-seat and remain at our
side. Intercede for us and ask thy Son to pardon us and receive us
into the ranks of thy elect in the realms of everlasting glory. {snip}
103. Then the devils started screaming:
104. "Oh, you who are enemy, our downfall and our destruction, why have you come from heaven to torture us so grievously? O advocate of
sinners, you who snatch them from the very jaws of hell, you who are a
most sure path to heaven, must we, in spite of ourselves, tell the
whole truth and confess before everyone who it is who is the cause of
our shame and our ruin? Oh, woe to us, princes of darkness.
{snip}
We have to say, however, reluctantly, that no soul who has really
persevered in her service has ever been damned with us; one single
sigh that she offers to the Blessed Trinity is worth far more than all
the prayers, desires, and aspirations of all the saints. We fear her
more than all the other saints in heaven together, and we have no
success with her faithful servants.
2 II. To Judge the Living and the Dead
678 Following in the steps of the prophets and John the Baptist, Jesus announced the judgment of the Last Day in his preaching. Then will the conduct of each one and the secrets of hearts be brought to light. Then will the culpable unbelief that counted the offer of God's grace as nothing be condemned. Our attitude to our neighbor will disclose acceptance or refusal of grace and divine love. On the Last Day Jesus will say:
"Truly I say to you, as you did it to one > of the least of these my
brethren, you did it to me."(Matthew 25:40)
679 Christ is Lord of eternal life. Full right to pass definitive judgment on the works and hearts of men belongs to him as redeemer of the world. He "acquired" this right by his cross. The Father has given "all judgement to the Son". Yet the Son did not come to judge, but to save and to give the life he has in himself. By rejecting grace in this life, one already judges oneself, receives according to one's works, and can even condemn oneself for all eternity by rejecting the Spirit of love.
3 The Fourth Lateran Council (1215) had mandated, "Every faithful of either sex who has reached the age of discretion should at least once a year faithfully confess all his sins in secret to his own priest. He should strive as far as possible to fulfill the penance imposed on him, and with reverence receive at least during Easter time the sacrament of the Eucharist." For good reason, this mandate became simply known as "the Easter duty."