I know that Magika damage attacks scale off Magika and so they are useless in a Stamina build. But what about defensive abilities like Spiked Armor? Do they also scale off Magika and so it is useless to use them with a Stam build?
All abilities that have a damaging effect in them scale with the resource you spend to cast them.
In this particular example, yes, Spiked armor returns Magic damage that scales off magicka.
In the recent update they have also reworked all skills to deal damage that corresponds to the magicka or stamina Champion tree passive.
Skills that cost magicka will scale off your spell damage and max magicka, and will always deal one of the Elemental Expert damage types (Apprentice tree):
Magic damage
Fire damage
Lightning damage
Ice damage
Skills that cost stamina will scale off your weapon damage and max stamina, and will always deal one of the Mighty damage types (Ritual tree):
Physical damage
Poison damage
Disease damage
So, you can easily tell if something scales off magicka or stamina by looking at their damage type and/or skill cost.
Note that while the damage of Spiked Armor scales off magicka because the skill costs magicka, major/minor buffs do not scale. So the armor and spell resistance from Spiked Armor (Major Resolve buff and Major Ward buff) will be identical for all builds. So if you like the idea of the damage mitigation from Spiked Armor, you can run it in on a stamina build. The downside of stamina builds is that they have to use their main resource for more than just using skills. You need stamina for sprinting, blocking, roll-dodging, etc. So you really don't need magicka for anything. Sometimes rather than just letting your magicka pool sit there and never be touched, you can use it to cast skills that give you major/minor buffs. Someone with 9000 magicka will get the same armor and spell resistance from Spiked Armor as someone with 45000 magicka. It is just the incidental damage of Spiked Armor that will be a weak for a stamina build. But the damage is a fairly minor part of Spiked Armor. It is mostly a damage mitigation skill, and the damage mitigation still works for a stamina build.