I do not know how to make a custom unit that only spawns when defending as a garrison force. But for creating basic custom units.
When you create the custom archer mod are you copying a melee unit and editing stats or are you copying the units_stats and units_stats_land files for an archer unit?
The easiest way is to copy an existing archer unit; edit it. Then create a custom skin for you unit. I've made several custom archer units in my campaign and dont have this issue.
RE: your general unit, I would copy the units_stats_land table and units_stats table for your bowmen general and below it the data for mounted archers. Make all the variables for your general unit, the same as the ones for the mounted archers.... Test it. If it works, you can then edit other variables (such as the style of horse your unit rides and what kind of officer it has etc....).
Hope this helps.