The impact of dark matter decays and annihilations on the formation of the first structures