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