generate_packets.py: Context manager for lazy_overwrite
I think it would also be sensible to enable lazy_overwrite; while refactoring the script in particular, but also in general – no need to rebuild the entire code base when the header didn't even actually change.
I think this is causing #43995 (discussion to continue on that ticket)
Part of #43927. Pack lazy overwrite code into a context manager and use it in fc_open() if lazy_overwrite is enabled.