Let $\mathcal{X}\subset C^0(\mathbb{R}^d;\mathbb{R}^d)$ be a non-empty, proper subset which is closed under composition. Under what conditions is the set $\mathcal{X}^{\infty}$ defined by $$ \mathcal{X}^{\infty}\triangleq \left\{ g \in C^0(\mathbb{R}^d;\mathbb{R}^d) : (\exists f \in \mathcal{X})\, f= \underbrace{g\circ\dots\circ g}_{\mbox{n times composed}} \right\} , $$ dense in $C^0(\mathbb{R}^d;\mathbb{R}^d)$?
Extended Question - Topological Version If $\mathbb{R}^d$ is replaced by any complete metric space, what additional constraints do I need, in addition to the ones on $\mathcal{X}$?