You can make a custom endpoint that checks if the username is taken or not.
Something like…
async isUsernameAvailable(ctx) {
let users = await strapi.entityService.findMany(
"plugin::users-permissions.user", { filters: { username: ctx.params.username }}
);
return users.length === 0;
}