This is a false narrative people keep pushing in order to ignore the reason pandas became threatened. Their population decline has one and one reason only, that is: habitat loss. In other words, as usual, it’s human fault.
Pandas mate and pump out healthy babies perfectly fine in the wild. They only refuse to mate in captive environments filled with onlookers. This is a very common behavior among captive animals of many different species, not just pandas. Probably most humans too.