Using get_theme_mod in php ajax form doesn’t work

You should never access directly theme files, form submissions, ajax, and even just get requests will be blocked at the server level by some security hardening measure.

Ignoring that for a moment, the reason your code fails is because wordpress wasn’t bootstrapped and therefor there are no core functions available. It is actually not 100% fail safe process to find from a theme file where the wordpress files are installed in order to bootstrap it which is yet another reason not to attempt to do access theme files directly.

You need to decide on a “normal” wordpress url to submit to the form (the post in which the pos is?), and probably intercept it on the init hook, or use ajax and write the appropriate ajax hooks and handlers.