The run does not count if the batter does not safely reach first. It does count if the batter does safely reach first.
From the 2016 MLB Rulebook:
5.08 (4.09) How a Team Scores
(a) One run shall be scored each time a runner legally advances to
and touches first, second, third and home base before three men
are put out to end the inning.
EXCEPTION: A run is not scored if the runner
advances to home base during a play in which the third
out is made (1) by the batter-runner before he touches
first base; (2) by any runner being forced out; or (3) by
a preceding runner who is declared out because he
failed to touch one of the bases.
And then how an out is made:
5.09 Making an Out
(a) (6.05) Retiring the Batter
A batter is out when:
...
(10) After a third strike or after he hits a fair ball, he or first
base is tagged before he touches first base;
Note how they group "after a third strike" with "hits a fair ball". (The normal third-strike scenario is covered earlier in the list, so it's clear that this is only a dropped third strike situation.) A dropped third strike with two outs or with first base open is essentially identical to a ball in play as far as the rulebook is concerned.
In fact, a further example of this is made clear in the rules, which while not this case is quite similar and addresses the "stolen base" part of your question directly, in 5.09 (14):
(14) With two out, a runner on third base, and two strikes on
the batter, the runner attempts to steal home base on a
legal pitch and the ball touches the runner in the batter’s
strike zone. The umpire shall call “Strike Three,” the batter
is out and the run shall not count; before two are out,
the umpire shall call “Strike Three,” the ball is dead, and
the run counts;
Similar to the scenario you ask about, the run does not count not because of the action of the runner (he's hit by a pitch, which is not something that makes you out) but because the batter is out.