Personally, I think if an immigrant of descendant of immigrants invents something prominent, it is fair for both countries to be proud of the accomplishment, and share that enthusiasm. It doesn't, or shouldn't hurt anyone. If anything, you are affirming accomplishment, not putting other people down.
Depending on the reasons for emigration, it might be fair to replace most of that pride with "dann, could have been 'ours'".
But other than not repeating those horrible conditions, the next step is to simply be proud of the accomplishment. In this case of algebra, Baghdad isn't the Baghdad of back then, nor Persia the Persia of then, all the people of the era are no longer with us, so what does it matter really? But hey, algebra is pretty cool. And Arabs/Persians happen to feel good about it. Good for them.
It's silly to put ethnicity ahead of national origin, though, since one of America's biggest qualities it that it is a melting pot. This feels like saying "If we put learning curve ahead of type safety Haskell can't claim anything to its name. Period." It's true, but kinda vacuous.