Do they have to take me back first before someone from outside of the company. Nope. Your employer may hire whomever they wish to.
Can they take him back first? Yes.
For whatever reason, it appears your employer is not interested in having you back. If they were, I expect they would have been in touch by now. I suggest you forcus your efforts in finding new employment elsewhere.