People had the same problem in Scandinavia 200 years ago when they had to adopt last names, but picking your grandfather's name as a last name is a bad idea, it'll end up like Denmark where half the population is named "Jensen". If everyone's surname is Maxamed then what's the point?
A better idea would be to just pick the ancestor that you normally abtiris up to (say, Ugaas-Diini for some Mareexaan here), that's what surnames are supposed to be, and just keep your abtiris as middle names. You can have an unlimited number of middle names. Sure it's weird to have 9 or 10 or even 30 middle names, but it's completely legit
