How to use a modified package file

Yes, fork arduino-esp32 and use platform_packages to change the source of framework-arduinoespressif32 to your fork with the fixed files.

But you should first make sure the check if

  1. the bug is fixed or not in the bleeding edge Arduino-ESP32
  2. if not, open an issue there