A teenager has been arrested after allegedly making threats to a Sydney mosque.