Matterbending Mage's last ability resolves before the spell that caused it to trigger. It resolves even if that spell is countered or otherwise leaves the stack.

Artwork
Loading artwork…
Matterbending Mage
Secrets of Strixhaven · #59 · EN
Nonfoil—Foil—
Card rules
When this creature enters, return up to one other target creature to its owner's hand.
Whenever you cast a spell with X in its mana cost, this creature can't be blocked this turn.
2/2
Uncommon · Illustrated by Flavio Greco Paglia
Format legality
Alchemy Legal
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Future Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions