Please note that this patch only addresses the order of header file includes in backend modules (and might not be thorough). It is possible that other modules may have a similar issue, but I have not evaluated them yet.
Attached is v2, which also includes the 0002 patch that addresses the order of header file includes in non-backend modules.