Is there any possible way to detect Native Code Generation?

I’m wondering if there is a way to detect Native Code Generation is possible. I have attempted detecting JIT on the device by using this script:

JIT Detector Script
local function isLuaJITAvailable()
    local function checkForLuaJITFeatures()
        if
            pcall(
                function()
                    return type(require("jit")) == "table"
                end
            )
         then
            return true
        end
        return false
    end

    local function checkForMetamethodOptimizations()
        local mt = {}
        setmetatable(
            mt,
            {__index = function()
                    return "jit"
                end}
        )
        return mt[1] == "jit"
    end

    if checkForLuaJITFeatures() or checkForMetamethodOptimizations() then
        return true
    end

    return false
end

local isLuaJIT = isLuaJITAvailable()

if isLuaJIT then
    print("LuaJIT is detected.")
else
    print("LuaJIT is not detected.")
end

This clearly doesn’t work as I have ran it on an iPhone 15 (17.5.1) that version does not contain JIT but it says it does.