#error freertos.h must be included before timer.h

Your patches are … not so good. Why did you do that ?
This in conjunction with your include path compiler options cause an include file name clash with the FreeRTOS timers.h.
Better use the original includes #include "lwip/timers.h" and add the path to the lwip include directory to the compiler options along with the path to the (separate !) FreeRTOS includes.