We've all been on a ride and realized we'd left some necessity in our garage, our jeans pocket or up in the shuttle car. That's why it's nice to keep some of those necessities at the ready at all times. There's probably a permanent home for a few of them in your go-to pack, including your go-to multi-tool. Another necessity is a spare car key, and this hack will combine the two.
You'll need a relatively large folding tool set. Partially to leave room for a long car key, but also because large folding tool sets always have something you don't need. Maybe it's a 6-millimeter allen, a t-10 or t-30 torx wrench, or a flathead screwdriver. Whatever it is, it may be thicker than your key, so have some washers handy. Pull the bolt out of the folding tool, measure its diameter, and set it all aside.
Carefully cut the sides off your key and measure if what's left is too long to fit in the tool. The longer the better, so leave what you can. Check how much clearance there is around your ignition switch and your car door handle. There's a chance it's too cramped around the ignition to fit a whole tool, but at least make sure it'll go deep enough to open your door. That way, you can leave your keys hidden in your car and you'll be able to get in and free them.
Drill a hole to match the diameter of the bolt, file the end smooth, and get ready for re-assembly. Whichever bit you've decided to replace, make sure there's room opposite it for the key. It seems to work best all the way to one edge or the other, so reorient the tools if necessary. Once everything's together, a dab of threadlocker on the bolt will help keep things from loosening up.
This hack won't work with every key, especially not fancy modern ones. But for the rest of us dirtbag mountain bikers, it's as fancy as it gets.