Being able to memorize large volumes of religious texts and recite them is a super power. I have been fortunate to observe many folks recite the 4000 verses of Nalayira Divya Prabandham aka the Tamil Vedas without aid of any text. So too for the Upanishads.
Despite the widespread use of printed material over the last two hundred fifty years and currently available digital tools, a lot of the Hindu literature and the Vedas are passed to successive generations orally. The oral method of teaching I think is critical in memorization of long verses. The teaching of such texts is done in a group setting. That dynamic seems to help further in memorization. The teaching also starts at a young age.
I must confess that I don’t memorize things easily. It takes a lot of daily repetition interspersed with finding the meanings of the verses that work for me. Various researchers have proposed techniques for speeding up memorization.
There is deliberate commitment to memory by learning the verses and there is indirect commitment to memory by just living our daily lives.
Is there a connection between having a robust memory and avoidance of dementia at old age and the ancient practice of learning large bodies of work at an early age? I sure think so.