implement "pip self-check" with automatic invocation by default

initial work cribbed from PR #1214 but then I changed direction a little
Are those headers needed if we request the json endpoint? Also how are we going to handle the switch to warehouse eventually?