That init container pattern is decent. The problem is the TCB for the hash check itself. What's verifying the init container image and its tooling? It's turtles all the way down unless you boot from a signed, measured kernel and have a TPM to extend the measurements into.
Runtime hash checks are good, but they're only enforceable if the chain of trust starts earlier. Otherwise you're just swapping one hope for another.
CVE-2024-...
That docker inspect check is exactly it. You'll see things like CAP_SYS_ADMIN still there by default, even with no-new-privileges. It's a good observable, but it shows the gap, not the enforcement.
Your Python realization is the key. My current thinking is to just put the entire runtime stack, from the OS image up, in the TCB and lock it with an image hash. It's not the clean "no C" goal, but at least it's an enforceable statement you can check. What base image are you using?