Because this life is when we are tested, we tend to tacitly assume that if we are going to the celestial kingdom, then at death we are already prepared for it. That is not true. This is the day in which we set our course. A man who is sincerely baptized, then suddenly died, has done what he needed to to set his course for the celestial kingdom, but he is not prepared to arrive there, and will not arrive there until he his ready. Nor will any of us, and the road is not a short one. We all have a significant way to go. Fortunately, there is time, there is a space of time between death and the resurrection.
The Celestial Kingdom and its laws are not like the laws of a country made by man, as one must learn about the laws and submit to them before entering it, rather than simply doing so after we arrive.
Joseph Smith taught it this way:
We consider that God has created man with a mind capable of instruction, and a faculty which may be enlarged in proportion to the heed and diligence given to the light communicated from heaven to the intellect; and that the nearer man approaches perfection, the clearer are his views, and the greater his enjoyments, till he has overcome the evils of his life and lost every desire for sin; and like the ancients, arrives at that point of faith where he is wrapped in the power and glory of his Maker and is caught up to dwell with Him. But we consider that this is a station to which no man ever arrived in a moment: he must have been instructed in the government and laws of that kingdom by proper degrees, until his mind is capable in some measure of comprehending the propriety, justice, equality, and consistency of the same. For further instruction we refer you to Deut. 32, where the Lord says, that Jacob is the lot of His inheritance. He found him in a desert land, and in the waste, howling wilderness; He led him about, He instructed him, He kept him as the apple of His eye, etc.; which will show the force of the last item advanced, that it is necessary for men to receive an understanding concerning the laws of the heavenly kingdom, before they are permitted to enter it: we mean the celestial glory. So dissimilar are the governments of men, and so divers are their laws, from the government and laws of heaven, that a man, for instance, hearing that there was a country on this globe called the United States of North America, could take his journey to this place without first learning the laws of governments; but the conditions of God’s kingdom are such, that all who are made partakers of that glory, are under the necessity of learning something respecting it previous to their entering into it. But the foreigner can come to this country without knowing a syllable of its laws, or even subscribing to obey them after he arrives. Why? Because the government of the United States does not require it: it only requires an obedience to its laws after the individual has arrived within its jurisdiction.