Just because the two weapons are made of the same material doesn't mean they are of equal strength/power, especially in the Marvel universe. Different techniques in their design, creation, and enchantments, all seem to play a part in the ultimate power of the weapon. Thor and the one who forged the weapon are both convinced this is the most powerful weapon they've ever created, so it stands to reason that we shouldn't compare them on a simple material level.
We also need to consider that Thor had disadvantages in both fights with Hela. In the beginning, he had the power of the hammer, but lacked a true understanding of his own power. In the end, he understood his one power, but lacked a weapon with which to channel that power through. This also fits in that in the beginning of Avengers: Infinity War:
He still has that power, but no sufficient weapon, and thus loses easily to Thanos and his servants. But come the end of the movie, he has both his powers and a great weapon to focus it through, and comes out a much greater threat.
In regard to that specific hit you're questioning:
The implication does seem to be that Stormbreaker combined with Thor's powers are indeed formidable enough to stand up to the power of the infinity stones, at least to some degree. Considering individual stones are capable of being destroyed from a variety of "non-infinitely powerful" means, I think it's safer to consider the stones as sources of incredible power rather than omnipotent power. That is to say, they are incredibly powerful, but not "all powerful", and can be overcome to at least an extent given other sufficiently powerful forces.
The stones, like any other weapon, are only as powerful as how they're used. If Thanos' goal was just using them for their unfocused power to stop Stormbreaker, and it overcame that, then that's one thing. If he had used the stones to cause the axe to unexist, or reverse time on it, would that have had an effect? Maybe, maybe not. All we know is that however he chose to act against it, it was at least more powerful than that, and thus he was hit.