Your description of molecular orbital theory is rather misleading, though I concede that it is introduced to students in the way you describe. To really understand what is going on you need a better understanding of how MO theory works.
If we write down the Schrodinger equation for a diatomic molecule like $H_2$ we find it has no analytic solution, so we look for ways of finding approximate solutions. One way of approximating the solution is to write it as a sum of some other functions $\phi_i$:
$$ \Psi = \sum a_i\phi_i $$
We call the functions $\phi_i$ basis functions, and they can be any functions we want - there is no special restriction on what we choose as our basis. However it makes sense to use functions that give a good approximation to $\Psi$ with as few terms as possible. In the case of the $H_2$ molecule an obvious choice for the basis functions is the hydrogen atomic orbitals i.e. the $1s$, $2s$, $2p$, etc.
To get a perfect expression for the $H_2$ wavefunction would require an infinite basis, but we would expect a reasonable approximation with a finite number of terms in the sum. In particular we expect to get a start by considering only two terms i.e. the $1s$ orbitals of the two hydrogen atoms. Let's call these $\phi_1$ and $\phi_2$, so our expression for the molecular wavefunction looks like:
$$ \Psi_{H_2} \approx a_1\phi_1 + a_2\phi_2 $$
And we want to choose the constants $a_1$ and $a_2$ to give the best approximation. For a diatomic molecule this is easy because the molecule is symmetric so $|\Psi|^2$ must be symmetric and that means $|a_1| = |a_2|$. The only possible expressions for $\Psi$ are (give or take a normalising factor):
$$ \Psi_{+} \approx \phi_1 + \phi_2 $$
$$ \Psi_{-} \approx \phi_1 - \phi_2 $$
The energy of these two orbitals is given by:
$$ E = \langle\Psi|H|\Psi\rangle $$
where $H$ is the Hamiltonian for the hydrogen molecule. If you're interested in the details I found quite a nice account here, but assuming the just want an overview the energy depends on the overlap integral $\langle\phi_1|\phi_2\rangle$. In brief, if the overlap integral is large then the energy is low and if the overlap integral is low then the energy is high.
And finally we get to the reason the signs of $\phi_1$ and $\phi_2$ matter. If both are positive then they add up and the sum is large in the region where they overlap. This makes the overlap integral large and gives a low energy. By contrast, if they have different signs then the sum (i.e. the difference) is small in the region where they overlap and the ovelap integral is low and the energy is high.
In physical chemistry, this problem is usually treated in MO-LCAO theory.
What you do is to assume that you can create the molecular orbitals of the molecule as a linear combination the atomic orbitals of the atoms in the molecule (MO-LCAO stands for Molecular Orbitals - Linear Combination of Atomic Orbitals). Therefore, your atomic orbitals are a mathematical basis set on which you project (using some coefficients) your molecular orbitals.
The problem is further simplified if you consider that the atomic orbitals that will combine together should have the same character for the symmetry operations possible for that molecule (it means that every atomic orbital combining should belong to the same point group, in order for their linear combinations to belong to that group). You can therefore create the SALC (Symmetry Adapted Linear Combinations), linear combinations of atomic orbitals of the same point group, and use them as a more powerful mathematical basis set for the molecular orbitals.
Stated this, you can calculate the coefficients of the linear combination and the energy of each molecular orbital. What you get is a certain number of levels (same number of the atomic orbitals considered in your basis set) ordered by their energy. You can now distinguish between three types of molecular orbitals:
bonding, the atomic orbitals constructively interfere in the region between the two atoms;
antibonding, the atomic orbitals destructively interfere in the region between the two atoms;
non bonding, the molecular orbital is almost identical to one atomic orbital (the coefficient of a certain atomic orbital is way greater than the others).
You can distinguish (at a very basic level) between them by representing the atomic orbitals involved and their sign in the region between the atoms: if they have the same sign, they are bonding, else they are antibonding. (Please note that by doing this I forget about the magnitude of the coefficient, that should be relevant in most cases.)
![Bonding orbitals for a biatomic molecule using as a basis set the shell $n=2$.](https://i.stack.imgur.com/bb0n8.jpg)
![Antibonding orbitals for the same molecule.](https://i.stack.imgur.com/WjrvT.jpg)
Now you have a sort of "ladder" of molecular orbitals and you know if each step is bonding or not. You can now put the electrons (same number as the sum of the electrons that where in the atomic orbitals you used in your basis set) as you did for isolated atoms: from bottom to top, two electrons in each level, antiparallel spin, and so on (the same rules also if you have more levels at the same energy).
You can now go back to a classical chemistry framework using the so called bond order:
$$ BO =1/2( n-n^*)$$
where $n$ is the number of electrons in bonding orbitals and $n^*$ is the number of electrons in antibonding orbitals (non bonding orbitals just doesn't count). The bond order tells (if it is an integer) how many bonds we represent in a classical picture, thus going back to the concept of octet rule.
In fact, consider the valence shell of oxygen. It is made by the atomic orbitals $2s$, $2p_x$, $2p_y$, $2p_z$ and it contains six electrons. By combining these (and ignoring the interaction between $2s$ and $2p_z$, that could be possible and that only modifies the energy of these molecular orbitals) you get $4\times 2$ molecular orbitals (the apex * means that they are antibonding).
![Molecular orbitals for the valence shell of oxygen.](https://i.stack.imgur.com/nngPX.jpg)
The electrons for oxygen are black (red ones are added when considering the F$_2$ molecule).
The bonding molecular orbitals from a shell of this type are four, therefore the total of the bonding electrons are eight. Here comes the octet rule, but this kind of reasoning is trying to fit an empirical and wrong way of reasoning into a more powerful and quantum framework.
Please note that my answer is from a really introductory and basic point of view; things, starting from this, can become a lot more complicated.
Best Answer
Your teacher is referring to the LCAO approximation as a way of calculating molecular orbitals.
Suppose you bring two hydrogen atoms together i.e. create a hydrogen molecule. To calculate the electronic structure you need to solve the Schrodinger equation, but even for something as simple as the hydrogen molecule the Schrodinger equation is too complex to solve analytically. To make progress we need to use some approximate method.
When the hydrogen atoms are a long distance apart we know the electronic structure is simple the wavefunction of a hydrogen atom, $\psi_H$. So in the hydrogen molecule it's a reasonable guess that the H$_2$ wavefunction might look a bit like a combination of the two atomic wavefunctions. We could add or subtract the atomic orbitals to give:
$$ \Psi_{H_2}^+ \approx \frac{1}{\sqrt{2}} \left( \psi_{H_a} + \psi_{H_b} \right) $$
or:
$$ \Psi_{H_2}^- \approx \frac{1}{\sqrt{2}} \left( \psi_{H_a} - \psi_{H_b} \right) $$
If you have a look at the molecular orbital diagram for hydrogen:
the wavefunction $\Psi_{H_2}^+$ is lower in energy than the atomic wavefunction because it increases the electron density in between the protons where they are attracted to both protons. By contrast $\Psi_{H_2}^-$ is higher in energy because it reduces the electron density in between the protons. Hence it's said that the two atomic orbitals split as the hydrogen atoms approach each other to give bonding and anti-bonding molecular orbitals.
But I must emphasise that this is a hand waving approach. In many circumstances it can give you a rough idea of what's going on, but it's a crude model and only useful in simple cases.