That can be achieved by just changing the settings.js template that gets copied over to new workspaces, no code changes required. Just uncomment flowFile: 'flows.json'
by default.
That will take effect only for new workspaces, and keep the existing ones untouched, as the settings.js is already there (and possibly customized).