Require Gem::Command* for tests

This is needed in various places after removing the unneeded requires
from lib/rubygems/ext*.
Do not attempt to build extensions when none exist

RubyGems only checked for extensions before attempting to build via
StubSpecification, but this check is inadequate.  Now the check exists
in both methods as the activation code may call build_extensions on a
real extension.