The value of X is determined only as Treeguard Duo’s triggered ability resolves, potentially including Treeguard Duo itself. It won’t change later in the turn if the number of creatures you control changes.