Dear Great Man,
Welcome back to the Wefugees Community and thank you for your very interesting question.
Yes, as far as I know, the period you contributed to the social insurance while holding an "Aufenthaltsgestattung" or "Duldung" does also count regarding the required 60 months contribution. I never came across a conflicting information. Nevertheless, I will also link our dear @mbeon-fardeen here to correct me in case.
All the best,