Why isn’t template_include working with AMP correctly?

Your endpoint is only applied to posts, add EP_PAGES to generate rules for page post type-

add_rewrite_endpoint( 'amp', EP_PERMALINK | EP_PAGES );

That should also be within a function hooked to init.

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