Header cleanup

This is a general cleanup of the situation with includes in Geany and also to improve them being scanned by tools like `g-ir-scanner`. The changes here are generally useful so there's no need to make them dependent on that.

I tried to make detailed commit messages but some of the commits are fairly large.

I wouldn't be surprised if one or more of these broke the plugin API or ABI but I tried fairly hard to not do that. It requires building on Windows and with non-Autotools build systems at least.