Thank you for your question. While the examples you cited from the history of the Infallibles (as) are correct, other members of the Ahl al-Bayt (as) married from outside of their communities and some of the wives and mothers of the Imams (as) were from places far from Arabia. They also married ladies outside of the Bani Hashim. Furthermore, the reports narrated from them (as) do not emphasise marrying from ones own community or to give priority to ones own community over others. Rather what is emphasised is that when seeking a spouse a person should look for someone with praiseworthy traits, taqwa being the most important, but other traits as well such as the ability to bear children, manners and good looks.
For practical purposes it is usually easier to assess these qualities in people that you know and people are usually more aware of the people they grow up around. But it is possible for people to assess these factors in people outside of their localities as well. As for the issue of improving yourself and then your community it is not related to this directly.
May you always be successful