To sum up the comments, only the following relation for the total amount of solution $$n_\mathrm{tot}$$ is universally true:

$$n_\mathrm{tot} = n_\mathrm{solvent} + n_\mathrm{solute} = \frac{m_\mathrm{solvent}}{M_\mathrm{solvent}} + \frac{m_\mathrm{solute}}{M_\mathrm{solute}}\tag{1}$$

The best you can do is to assume that $$n_\mathrm{tot}\approx n_\mathrm{solvent}$$ for the diluted solutions of small molecules. Also, if the molar masses are similar $$(M_\mathrm{solvent}\approx M_\mathrm{solute}\approx \bar{M}),$$ the expression can be lead to a common denominator:

$$n_\mathrm{tot} \approx \frac{m_\mathrm{solvent} + m_\mathrm{solute}}{\bar{M}}\tag{2}$$

This can be the case, for example, for the solution of ammonium nitrate $$(M(\ce{NH4NO3}) = \pu{80.043 g mol^-1})$$ in DMSO $$(M(\text{DMSO}) = \pu{78.13 g mol^-1}).$$

Algebra aside, your mistake was also neglecting $$M_\mathrm{solvent}.$$ Keep in mind you can always check dimensions. For your proposed formula

$$n_\mathrm{solvent} + n_\mathrm{solute} = \frac{M}{m_\mathrm{solvent} + m_\mathrm{solute}}$$

it doesn't work out well:

$$\mathrm{dim}~n_\mathrm{tot} = \mathsf{M}\cdot\mathsf{N}^{-1}\cdot\mathsf{M}^{-1} = \mathsf{N}^{-1} \neq \mathsf{N}\tag{3}$$

Illustrating with common units used in chemistry:

$$[n_\mathrm{tot}] = \frac{[M]}{[m_\mathrm{solvent}] + [m_\mathrm{solute}]} = \frac{\pu{g mol^-1}}{\pu{g}} = \pu{mol^-1} \neq \pu{mol}\tag{4}$$