  The Kappa biochemistry and the M{\O}D organic chemistry frameworks are
amongst the most intensely developed applications of rewriting-based methods in
the life sciences to date. A typical feature of these types of rewriting
theories is the necessity to implement certain structural constraints on the
objects to be rewritten (a protein is empirically found to have a certain
signature of sites, a carbon atom can form at most four bonds, ...). In this
paper, we contribute a number of original developments that permit to implement
a universal theory of continuous-time Markov chains (CTMCs) for stochastic
rewriting systems. Our core mathematical concepts are a novel rule algebra
construction for the relevant setting of rewriting rules with conditions, both
in Double- and in Sesqui-Pushout semantics, augmented by a suitable stochastic
mechanics formalism extension that permits to derive dynamical evolution
equations for pattern-counting statistics. A second main contribution of our
paper is a novel framework of restricted rewriting theories, which comprises a
rule-algebra calculus under the restriction to so-called constraint-preserving
completions of application conditions (for rules considered to act only upon
objects of the underlying category satisfying a globally fixed set of
structural constraints). This novel framework in turn renders a faithful
encoding of bio- and organo-chemical rewriting in the sense of Kappa and M{\O}D
possible, which allows us to derive a rewriting-based formulation of reaction
systems including a full-fledged CTMC semantics as instances of our universal
CTMC framework. While offering an interesting new perspective and conceptual
simplification of this semantics in the setting of Kappa, both the formal
encoding and the CTMC semantics of organo-chemical reaction systems as
motivated by the M{\O}D framework are the first such results of their kind.
