Wa `alaykum As-Salamu waRahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear questioner, we would like to thank you for the great confidence you place in us, and we implore Allah Almighty to help us serve His cause and render our work for His Sake.
Answering your question, Dr. Muhammad Salama, PhD, Islamic Studies in English, Associate Professor at the Faculty of Islamic Sciences al-Madinah International University (Mediu), states:
The hadith you cited is a threat to those who falsely attribute themselves to other than their real fathers. This is actually a grave practice that has evil repercussions. One can imagine the chaos that will take place, from the Islamic perspective, in terms of marriageability and inheritance issues, which contradicts the objectives of the Shari`ah in this regard.
The threat applies to the one who does this intentionally or it has been done to him and he is pleased with it. So, if you can take any measures to change your family name in official papers, you have to take them.
However, if this is not possible, at least you have to observe the Islamic laws and limits in your relation with the members (particularly females) of this family, which is not really your family, and also to teach these laws and limits to your children.
This way you save yourself from the threat mentioned in the hadith as you have done what you can do and showed that you are not pleased with this situation.
May Allah admit you into His Paradise.
Allah Almighty knows best.