Is it common or Legal for a Company to ask an employee to put in their two weeks in to resign just to apply for a job in a different department within the same company, in the same building?
In some countries, it's not very uncommon. For example, in Germany, you are asked to resign before you get to sign your new contract. I had this two times already, one time for a change of working hours and the other time for a promotion.
In both cases, I added a restriction to my resignation letter to just resigned for a new contract to take effect. It was in both cases needed because you basically have to resign from your current position to get the new contract because of the size of our company in addition to the regulations by the union.
This is very unusual in my experience. I'm in the US, but not in Texas, and I've never heard of a situation where a company asks you to resign to take another position in the same company. I've certainly never heard of requiring someone to resign just to pursue such another position within the company.
Having done it myself, I'll say that the normal procedure (at least that I've observed and been through) is that you ask to be considered for a transfer - presumably with your supervisor's knowledge - and interview for the job just like another candidate. If you get the job, you just transfer; if not, you stay in the job you're in. (Depending on your boss and the situation, the latter possibility may be awkward, but that's getting off topic.)
You are doing things out of order. You need to apply for the job, and secure the job first. Once you have secured the job, then you should resign from your current position, so you can work the new position within the company. Do not ever resign from a job without having one secured already, ever.
I have done this once in the past where I landed a job in the same company, and then I resigned from the current position I was working at the time. The only difference is the new position was in a different building.
I have known of only one situation were somebody had to quit the company for what many would view as a internal transfer. In that case there was a publicly known parent company but the two jobs were in two different subsidiaries.
The issue was that the benefit packages for those two companies were vastly different: one still had a pension, the other didn't; one had a small 401(k) match, the other had a large 401(k); one had unlimited sick leave the other one had 3 days per year. The parent company spent 3 years merging the two parts of the company due to the vastly different benefits.
The rule to resign only kicked in when you were accepting the new position.
In all other cases I have either experienced, or observed, a person moving internally wasn't required or even asked to quit the company. I have never heard of having to tell the current manager when applying for a position. That notice would only happen after accepting the position.