To the best of my knowledge, they do not "take over your phone" but simply broadcast an alert. Much like amber alerts or silver alerts or weather alerts or the various other alerts you can get on your phone. The only difference with the "presidential alert" (which I think is how it is referred to on my phone) is that you cannot disable it whereas you can prevent your phone from receiving other types of alerts. Having said that, assuming it works like the other alerts (which I suspect it does) you can dismiss the alert as soon as you get it and continue using your phone like you do whenever you dismiss any other alert/phone call/etc.
I suspect that the 2 hours isn't the length of time of the test but the time window in which the test is scheduled to occur. Alternatively, it's possible that they aren't sending it to the entire country at once but to different regions at different times.
A single engineer test doesn't really work when you are testing a broadcast to everyone (or very large groups anyway). I'm sure they have direct physical access to enough phones to have a reasonable sample size to assess that it worked as expected.
If they really wanted to take over your phone, they would do it silently in the background without your knowledge.
RE: An Emergency Alert Test - Tomorrow October 4th, 2023