Personally, I prefer pregnancy after marriage. I believe bringing a child into the world is a big responsibility, and I would rather have that experience within a committed marriage. Marriage does not mean everything will automatically be perfect, but I believe it can give two people time to understand each other, plan their future, and prepare themselves. Having a child is more than just giving birth. It comes with financial responsibilities, emotional responsibilities and providing a better education for the child. That is why, for me, I would rather prefer to get married first and then have children when my partner and I are ready.
I agree with you because if a child is born before marriage and after if the couple does not get married, then that child grows up in a very bad environment and it can have a big impact on his life, Because he moves away from the love of his parents. So if a child is born after marriage, the child grows up in a healthy care and that is what should happen. From the perspective of our country, having a child before marriage is like a crime, because living relationships are prohibited here. And our religion also prohibits it. So from a religious point of view, having a child after marriage is the most reasonable.
Putting religion and culture of each country aside, having a child before marriage is something couple should probably avoid. Women especially need to be strictly firm on this, because if shit goes sideways. They are the ones who end up carrying the biggest loss. Meanwhile, men do not have to deal with nearly as many physical or social consequences.
Not to mention, child can end up missing out too if they don't grow up with proper care and attention from both parent like you said. So, having kid before marriage can be a pretty bad idea.