From https://gcc.gnu.org/onlinedocs/cpp/Once-Only-Headers.html:
If a header file happens to be included twice, the compiler will process its contents twice. This is very likely to cause an error, e.g. when the compiler sees the same structure definition twice. Even if it does not, it will certainly waste time.
This PR fixes the three headers that have content outside their guards and modifies test/lint/lint-include-guards.py to catch such violations in the future.
A prerequisite for #36808.