The page says:
The “_” and “%” wildcards are allowed when specifying database names in GRANT statements that grant privileges at the global or database levels. This means, for example, that if you want to use a “_” character as part of a database name, you should specify it as “\_” in the GRANT statement, to prevent the user from being able to access additional databases matching the wildcard pattern; for example, GRANT ... ON `foo\_bar`.* TO ....
_ for \_
It´s Simple str_replace foo_bar for foo\_bar on user and database creation time.
How ispconfig works to grant? you can modify mysql database tables direct insted use grant commands, and before flush privileges.
I belive if Modify table direct alows long usernames but grant commands at console will be not work and need change username for more then 16 chars at mysql user table.
Idea but php cli script to manipulate user rights.
Im using _ on database names and user names. like cpanel and others. it´s interessant checks how ispconfig works.