Detect Ajax call inside pre_get_posts function

Unless you pass through that information that it’s on that archive page there is no way for the request handling the AJAX response to know.

Remember that every new request to the server is a blank slate, there’s no shared context that follows the page from the initial request to the AJAX requests unless you explicitly create it and pass it along yourself via cookies, POST parameters, GET parameters, user meta, etc