Student or Learner
Is it OK to write: They wanted to buy a pillow for their baby whom hadn't been born yet.
Maybe it should be: ... whom wasn't born yet.
What was wrong with "whom"?
You would say "he hadn't been born" (or "he wasn't born"), not "him hadn't been born."
Although the pillow is for HIM, "he" would still be the subject of the embedded clause. Because it's a subject, you use "who" instead of "whom."
I'm not a teacher, but I write for a living. Please don't ask me about 2nd conditionals, but I'm a safe bet for what reads well in (American) English.