It is probably the only undocumented genetic record ever existing in modern times that traces back to probably the beginning of Mankind so to speak. You do not marry within Gotras as it would amount to incestual relationship. Men from Upper Castes were allowed to marry any Woman from Lower Caste but vice-versa was disallowed [1]. However, even the Upper/Lower Caste marriage was frowned upon because of lack of information of Gotras.
Another thing you should note is that Caste System only came into prevalence in the past 2500 years. Before that we had Varna System. In the Varna System, you could "choose" your Profession. If you wanted to be a teacher who was well versed in Vedic scriptures, you would learn under a Guru and become a Brahmin. If you wanted to be a fighter, you would train martial arts and weaponry under a Guru and become a Kshatriya. If you wanted to get into trade you would be a Vaishya. If you wanted to serve the society you would be a Shudra. One more important point to note: In Sanatan Dharma, all are born as Shudras. It is only after the age of 8, when they go through a thread ceremony called Upanayana do they get initiated into Brahmacharya (and then they go on to become Brahmin, Kshatriya, Vaishya etc based on their interests). This is called Dvija (or twice born: first birth was as Shudra and your second birth is into the Varna that you choose). This system was corrupted, especially in the medieval times and turned into "Caste System".
So when you ask if surname can be changed nope it doesn't fix anything. If you want to marry someone you'll have to provide details of your Gotra along with your lineage of your immediate 2 ancestors (typically father and grand-father). And most of these communities are closely knit. So they'll know immediately if you are faking it.
The only remedy is to go back to Varna System and completely abolish the Caste System as it originally was. Where these were considered as Professions alone and not as something that you acquire just by being born into that family. Just like me being born into an Engineers family doesn't automatically make me an Engineer, same way, being born into a Brahmin family won't make me a Brahmin. It will just make me "Brahma-Bandhu". This was the technical term used.
[1] The reason vice-versa was disallowed is because women inherit the man's Gotra after marriage. But the reverse does not happen. Why? Because, the man is the seed giver while the woman is the nourisher. To better explain it: If you consider Mother Earth as woman, and Apple Seed representing the man, if you plant the seed in Earth, you'll have an Apple Tree. Not a Mango Tree. Not a Peach Tree. Earth doesn't get to decide what becomes of the Tree. It only nourishes it. It is the seed which decides the nature/characteristics of the Tree. So Gotra is of the man not the woman. Another reason why we have had a Patriarchal Society for a long time (though this has changed considerably). Because it becomes the responsibility of the man to protect his lineage/clan from external threats.
Keep in mind that these were all done for an era that does not exist today. We cannot fathom the issues/threats they faced that required them to have such systems. Many of it can be taken as is in modern times, while many need to be changed/fixed/removed/abolished. But one good thing is that the system has a self-healing capacity. Slowly but surely things are changing.