This ability of the brain is known as neuroplasticity or brain plasticity. It is a term that refers to the brain's ability to change throughout life.
In the 1960s, it was confirmed that the brain can rewire itself either due to learning and experience or due to injury or damage, even during adulthood. This theory came to correct the previous view of a static and unchanged adult human brain. Therefore, there is data supporting the idea that the adult brain has the ability of neurogenesis and can in some cases heal itself.