Thanks for the report, filed an investigation here: https://bugs.webkit.org/show_bug.cgi?id=253063
You may have success with following instructions, replacing Safari with SafariForWebKitDevelopment:
https://apple.stackexchange.com/questions/429814/how-do-you-programmatically-enable-the-develop-menu-in-safari-15-on-macos-12
Unfortunately at the moment I do not immediately have an environment to reproduce the problem here.
Topic:
App & System Services
SubTopic:
Core OS
Tags: