There are three sides to this question, RSA in general, RSA with SSH and SSH with other cryptosystems.
In RSA the public and private key each notionally consist of two values.
- The modulus, this is common to both public and private keys.
- The exponent, there is a seperate public exponent for the public key and private exponent for the private key.
So in theory A RSA private key doesn't have to contain the public key. In practice however.
- Most practical private key formats contain additional information. They usually include the public exponent because it's actually useful to be able create a public key file from the private key file. They also normally include the raw p and q values and a handful of extra derived values to speed up private key operations.
- The public key exponent is usually one of a handful of well-known values. On most RSA keys even if you have is the modulus and private exponent it would not be hard to figure out the public exponent by trial and error.
According to http://blog.oddbit.com/2011/05/08/converting-openssh-public-keys/ openssh uses the pkcs#1 private key format. According to https://www.rfc-editor.org/rfc/rfc3447#appendix-A.1.2 this format contains the modulus, the public and private exponents, both primes and a number of other values that are useful for optimising private key operations. Including the public key information does not appear to be optional.
So for RSA you are fine as you have already discovered you can easilly fish the public key parameters out of the private key structure.
For SSH with ECDSA it seems that the public key parameters are not normally stored as part of the private key but can be easilly derived from it. https://stackoverflow.com/questions/12480776/how-do-i-obtain-the-public-key-from-an-ecdsa-private-key-in-openssl
YMMV with other cryptosystems.