Both sentence structures are grammatically correct and convey similar meanings, however the second sentence structure is more commonly used and is considered to be more idiomatic.
The first sentence, "Is death like when you were not born yet?" is asking if death is similar to the state of not existing before birth, which is a common way of thinking about death, however the structure could be more idiomatic.
The second sentence "Is death like it was before you were born?" is asking if death is similar to the state of not existing before birth, but the structure is more common and natural.
In both sentences you are asking if death is similar to the state of not existing before birth, but the second sentence is a more natural and idiomatic way of expressing this idea in English.
It is important to remember that language is always evolving, and sometimes it's possible to find different ways of expressing the same idea. If you are a non-native speaker, you may not be familiar with the idiomatic ways of expressing a certain idea and that's completely normal. The more you practice and read, the more you will be exposed to different ways of expressing different ideas. Hope this helps, feel free to ask me any further questions.