Page Template Dropdown For Custom Post Types

Well, even at a quick glance, I can see that you are using the same meta box ID – postparentdiv – both times, which probably causes issues internally.

That said, this seems a convoluted path to take at all, and possibly an XY Problem.

Why do you need to scan for templates at all?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)