I found this fatwa on islamonlien that explains the 40 days issue:
General introdurction on nifaas and some rulings related to it
First you should know that the bleeding after child birth is called nifaas and it has a similar ruling as the menses: Meaning it is unlawful to have a spousal relationship while it has not stopped, it is necessary to take ghusl when it ended. Scholars have somewhat different rulings on the longest time of the nifaas. This time period is actually different from woman to woman and also depending on some factors. For example it is usually stronger or feels harder for the 2nd, 3rd etc. baby.
On the forty days limitation and other opinions
The sunnah sets the limit to forty days:
The woman having bleeding after delivery (puerperal haemorrhage) would refrain (from prayer) for forty days or forty nights; and we would anoint our faces with an aromatic herb called wars to remove dark spots. (See for example in Sunan abi Dawod)
This means if this bleeding doesn't stop forty days after the child birth the woman can/must take her ghusl and go on praying, fasting etc. and the bleeding is considered as having ended. While if it stopped earlier she must go and do ghusl and go back praying and fasting etc..
Some other references can be found here in Sunan abi Dawod and Jami' at-Tirmidhi who claimed a consensus among the shahaba on this limitation.
Nevertheless some schools of fiqh say the longest period is of sixty days among them is a-Shafi'i according the linked fatwa quoting sheikh Yusuf al-Qaradawi. Imam at-Tahawi claimed that this claim rose after the time of sahaba () while they had consensus on forty days as a limitation. Imam at-Tirmidhi said that al-Hassan al-Basri said a woman should only start praying again if she still saw blood after fifty days while 'Ata ibn abi Rabah and a-Sha'abi said after sixty days, while he counted a-Shafi'i, Sufyan a-Thawri, Ishaaq ibn Rahwayh, imam Ahamd and ibn al-Mubarak to the majority.
As you said nifaas is not universal standard and the forty days are considered as the upper limit by the majority of scholars based on reliable hadith narrations and the consensus of the sahaba () they don't apply to every woman giving birth, so if a woman has clear evidence that her bleeding has ended she must perform ghusl and return to all prescribed worships as usual after her menses.
As for spending the time at her mother's place this might be a cultural issue and as said in my former comment -with some false assumption due to lack of knowledge- it is certainly easier for a mother who gave birth for the first time to have helpful hands around her, especially of people that she trusts -like her mother or sister- if she had no midwife and no experience with new-borns and babies. Some women might actually prefer being alone or getting help from the husband or the husbands family or relatives or friends at their own home. So this doesn't seem to have any clear backup in the sunnah and Allah knows best!
Also note that a woman after child birth shouldn't stop all activities unless a doctor has told her so (for example in case of a C-section standing/walking/carrying might not be good for her fissures) this is a myth many woman seem still to believe, it is rather recommended to do all daily activity as soon as possible in an adequate manner.
Some additional sources I've consulted:
- islamqa #104589 on the "return" of blood after forty days.
- islamweb #49899 on how one should count the time for nifaas (in Arabic).
- islamqa #31803 on what to do if a woman didn't pray as nifaas toke longer than forty days.