Yes one can be saved by desire of baptism, if one’s life is taken short during his/her catechetical stage of learning the faith on the road to baptism.
There is also baptism by blood, which saints and martyrs were baptised in such as the “good thief” on the cross with Jesus.
According to the OP’s commentary not the post heading. I think the word you may be looking for when one receives the sacrament of baptism is “the disposition of the person receiving the sacrament”.
A sacrament is something that “God joins together which no man can put asunder”. A valid sacrament can never be negated, no matter the character of the priest or the disposition of the person receiving the sacrament. The “act of God” He sets in motion when the sacrament is administered. Grant it, if the disposition of the recipient is believing and open to the gift, the recipient is graced and mercy given.
Now if the recipient’s disposition is not understanding or dis-believing, the valid sacrament is still administered upon the soul. The gift of graces and mercy are still given, but delayed until the recipient’s disposition comes to belief at this moment of coming to belief the graces are poured out upon him/her.
What is interesting is that many miracles are attributed to these lack of believing souls become believers when they receive their graces later in life. For example; when tragedy strikes or fear of death arises, that the soul calls out to God in belief while in despair and hope-less, that baptismal graces and mercy are poured forth upon the changed disposition of the recipient of the baptism.
In an infants baptism, the god parents and parents profess the baptism vows for the infant in their belief and faith, until the infant comes of age and says “yes” to God, his/her baptismal graces are poured out. A valid sacrament after administered can never be removed by man only rejected. An unbelief does not constitute a rejection, for in order to reject a sacrament, one has to come to the full understanding of what it is.
Peace be with you