So, now your little ad-hoc substitute-naming scheme has legal ramifications. Good luck getting this to play along with actual letter of the law (at $location1, not to mention $anotherlocation2).
It's not my naming scheme, it's what the hospital I know uses. Can you explain the legal ramifications you are concerned about? The baby does not receive a SSN until it is named by the parents. If the parents were to die before the baby is named, the temporary name used "in the system" doesn't magically become a legal name.
Sorry, I have misunderstood as "this is what I would do." I suppose that's a process descended from the local legal framework, then - as you say, SSN is assigned after name, and the name has some flag meaning "temporary". I would assume there's some handling in place for that eventuality.
(I have seen a different protocol: state ID number is assigned after birth, parents choose name independently of the process, the two are only linked ex post)