Does how you discard a Madness card affect whether it resolve before its source?
Yes to both questions.
Madness is a two-part keyword ability:

702.34a Madness is a keyword that represents two abilities. The first is a static ability that functions while the card with madness is in a player’s hand. The second is a triggered ability that functions when the first ability is applied. “Madness [cost]” means “If a player would discard this card, that player discards it, but exiles it instead of putting it into his or her graveyard” and “When this card is exiled this way, its owner may cast it by paying [cost] rather than paying its mana cost. If that player doesn’t, he or she puts this card into his or her graveyard.”

If you discard a Madness card as part of the costs of a spell or ability, the Madness trigger will be on top of the spell or ability that had the discard cost, because putting that spell or ability on the stack is always the very first step, before costs are paid:

601.2. To cast a spell is to take it from where it is (usually the hand), put it on the stack, and pay its costs, so that it will eventually resolve and have its effect. [..]]
602.2. To activate an ability is to put it onto the stack and pay its costs, so that it will eventually resolve and have its effect.

If the discard happens as part of the effect of a spell or ability, it can obviously only happen after that spell or ability has resolved, not before. The Madness trigger goes on the stack immediately after resolution of that spell or ability.