The HP issue is simple math, really. You get the same number of stat points either way, but to get your actual defensive capacity, you multiply HP and the defense stat. Because Skarmory's Defense is much higher than its HP, boosting the HP brings the stats closer to being even. When you have to distribute points to make the highest number when multiplied, the way to win is to split them equally if possible or make them as close as possible. Therefore, Skarm wants its max HP before boosting physical defense. This is also why you max Snorlax's and Hariyama's Defenses rather than HP.
If the above was a little unclear, think of it this way: your stats (HP and the defense in question) are the dimensions of a rectangle. Your goal is to cover the largest surface area possible. The solution is to make a square or as square a rectangle as you can. There can be reasons to do otherwise sometimes (boosting HP to increase overall endurance (because HP helps both Def and SpDef) or to increase Leftovers healing or whatever), but in general, you try to even them out.