Oh, but water baptism had been done many times before! In many types of situations, for multiple different purposes. But in all cases, immersion in clean water is an act of purification.
- Sometimes immersion alone is sufficient to cleanse impurity, such as after marital relations.
- Sometimes immersion must be accompanied by sacrifice, such as for certain unintentional sins.
- Priests are immersed as part of their consecration (literally, "setting apart") into service in the Temple.
- In some cases water stored in clay jars is sufficient for immersion, but in others "living water" (naturally flowing water never dammed) is required.
The laws of purity and impurity are complex but chapter 16 of this book explains them well. Note, however, that this linked explanation also includes Karaite interpretations that are not in the written Torah.
John's baptism is grounded in a thorough understanding of purity and impurity as revealed in Torah and by the prophets. If you search for allusions to immersion in the prophets you will find amazing parallels.
For example, Ezekiel observed a stream of water emerging from the altar in his vision of a Temple, and out under the steps. This stream became a great river of flowing (living) water which he was immersed in as he followed it. (Ezk 47) Later, on the last day of Sukkot, Jesus stood on the steps of the Temple and proclaimed, "Anyone who believes in me may come and drink!" See the parallel? (John 7:37)
Even an exercise in looking for the first occurrence of immersion in water reveals mysteries.
- The first priest to be consecrated by immersion was Aaron himself, by Moses. (Lev 8:6)
- The entire earth was immersed in water by God to purge it of mankind's rebellion, saving only Noah's family and enough animals to replenish the earth. (Genesis 6, 7)
- But there is an even earlier instance of immersion in water - the act of Creation itself. "And the Spirit of Elohim was moving over the face of the waters. And Elohim said, let there be light." (Gen 1:2-3)
Baptism itself is by no means an innovation of John the Baptist. Only his application of it was unprecedented.
As to the second part of your question, which is a good question, even the immersion performed "at" the Temple was not performed inside the Temple, but around the perimeter. The Hebrew word translated sacrifice is qorban, literally to come near or approach. Before approaching Adonai in sacrifice, the Jew was immersed to purify the body. Dozens of mikveh baths have been excavated around the Temple Mount in modern times that were used for this purpose.
John's baptism was based on the premise that confession of sins, repentance and immersion is an act of purification of both body and spirit. This is why Simon Peter at Pentecost, standing among the mikveh baths, declared that one must "repent and be baptized for the forgiveness of sins" (Acts 2). This doctrine did not begin with Yeshua, it was taught by Yochannan the Immerser. Neither the purification of the spirit through confession and repentance, nor the purification of the body through immersion, is required to be done on the Temple grounds. Yochannan ministered at the Jordan river because it is a convenient way to immerse in living water.
To prove the validity of John's baptism using only Tanakh requires a deep, clear and thorough understanding. John and his movement that waited for Messiah had this doctrine, but the Pharisees and Sadducees doubted it, which is why they sent interrogators to the river to question him.