compiler error that depends upon the location of a typedef...

are there any alternatives to it?

Move all the typedefs to a separate .h file...
Or you can move most of your code, including the typedefs, to a .cpp file instead of a .ino file (and use your own function prototypes, where needed.)

IMHO this seems to be more of an error in how the preprocessor is working.

Yeah, probably. The automatic prototype generation is hard to get right. If moving the typdef to the start of the file helps, then it's gotten a lot better than it used to be. (The extra .h file pretty much used to be the only solution.)