Exactly. They typically give pregnant women a Tdap booster in the 2nd trimester. The mother develops an immune response and she transmits those antibodies to the baby. When the baby is born, they have some temporary protection against those diseases, but as you said, it only last a month or two.