Assuming that Doug is not spending the majority of the movie dreaming in a chair at Recall, but everything he experiences is really happening, the proposed series of events could be as follows:
Vilos Cohaagen is administrator on Mars, Hauser is his trusted friend and employee. During the colonization of Mars, Cohaagen has sacrificed many workers by letting them work to death, and allowing others to mutate into hideous forms, due to poor shielding from space radiation and bad air quality. Cohaagen further extorts Mars' inhabitants with high taxes on air, threatening to shut off the air to those who oppose him. This causes a resistance group of Martians (colonists and mutants) to start terrorist actions against Cohaagen's forces, in order to free Mars from his oppression. During mining operations in the Pyramid mountains, workers discover remnants of an ancient alien civilization. Its purpose was perhaps to make Mars an habitable planet with its own atmosphere; however, that would effectively take away Cohaagen's source of power, so he closes the mine and keeps the finding a secret, maintaining that the alien machinery was there to cause a global meltdown and destroy Mars if it was ever turned on (or he likes to believe that, at least). The resistance leader, Kuato, learns about the secret, and that it may be the key to the salvation of the planet, so he desperately seeks the truth.
Several attempts are made to eradicate the resistance, but the rebels are well hidden among the inhabitants of Mars; infiltration missions fail because many of the mutants are psychic and spot the spies eventually before they can find out who and where Kuato is. So Cohaagen and Hauser set up a delicate plan. Hauser starts spying on a woman called Melina, who is suspected of working with the rebels. He gains her trust by convincing her he wants to get out of Cohaagen's organisation. Just when he is ready to be introduced into the resistance, Hauser pulls out and 'disappears' to make the rebels and Melina think he has been caught and killed by Cohaagen. A trail is set for 'Douglas Quaid' to find his way into the heart of the resistance. Hauser tapes a video to himself, explaining how he wanted to betray Cohaagen, and that Quaid needs to go to Mars to join the rebels. He also makes another tape, one to be revealed to Quaid after Kuato has been killed, explaining the entire scheme. A suite in the Hilton Hotel on Mars is rented in Houser's name, and a message is left there with instructions to find Melina. Hauser's memory is isolated and blocked, a bug is inserted in his head and he gets the memory and personality of Douglas Quaid, a construction worker on Earth. One of Cohaagen's spies, Lori, goes to live with him pretending she is his wife, making sure that he remembers nothing of his former life. Other people keeping an eye on Quaid are Harry, who impersonates a colleague on his work, and Richter. None of them, however, are told that Hauser is actually a double agent; they simply believe Hauser is a traitor who got punished by having to live out his days on Earth as Quaid.
The object is to have Quaid return to Mars after a while so he can get into contact with Melina and the resistance again. Unfortunately, this plan gets accelerated when Quaid unexpectedly begins to have dreams of his former life on Mars as Hauser. He is so fascinated by these dreams that he goes to Rekall to have a trip to Mars implanted. However, during the implantation procedure, the scientists inadvertently reactivate Hauser's memory. They wipe it and restore Quaid's personality again, but Harry, Lori and Richter fear that the procedure at Rekall will cause Hauser to resurface again, so they try to kill him, despite Cohaagen's orders to bring Quaid back alive. Cohaagen has another agent deliver a suitcase to Quaid, containing the first Hauser message, the bug extractor, and enough information to get to the Hilton Hotel on Mars and find the message to look for Melina. On Mars, Benny, another one of Cohaagen's spies, helps Quaid to get where he needs to be. But Melina does not believe Quaid's story and sends him away. Benny relays this information to Cohaagen, who calls in Dr. Edgemar from Rekall to present himself to Quaid as a memory implant, in an attempt to fool Quaid into handing himself over with Lori's help (Edgemar may even be the person who wiped Hauser's mind the first time). It is not quite sure why they want Quaid back now; perhaps they want to reacquire him and try another way to get him to Kuato, now that Melina seems unlikely to be of any help. Despite that Quaid sees through Edgemar's ruse, Richter's men succeed in catching him. He is unexpectedly rescued by Melina, and from there, Quaid fulfills his purpose of meeting Kuato and getting Benny close enough to kill him. Afterwards, Quaid learns from Hauser's message how he has essentially been double-crossed by himself. The big flaw in this plan was obviously that 'Quaid', the new personality, could not be adequately controlled, and started to defend his own existence, leading to him activating the alien device, and the bad guy becoming the hero.
This explanation leaves several coincidences unaccounted for: e.g. Bob from Rekall, Dr. Lull, the Rekall technician and Dr. Edgemar give a lot of examples of what will happen in the implanted dream, which happens in actuality later on. However, they may have alternate explanations: There is a possibility that programmers from Rekall did some field research on Mars for creating the Ego Trip, heard all the rumours going around about the Pyramid Mountains, the alien machinery, its purpose, and the prophecy of someone saving Mars one day, and decided to make these elements part of the Ego Trip (and thus accidentally predicted the future). Dr Edgemar is probably one of Cohaagen's trusted employees, and as such, one of the few people who knew exactly what had happened to Doug and what the alien machinery could do. Since Doug is still hesitant to believe him, Edgemar has no choice but to fabricate a story, and make it as convincing as possible, by including his own believes and predictions, hoping the amount of detail will convince Doug that he tells the truth (and initially, it worked).
In any way,it should be noted that in the audio commentary, Verhoeven correctly states that the quality of the script is examplified by the fact that two characters can accurately predict the direction the story will go in, yet the film retains its edge-of-the-seat feel.