This issue is not reproducible with the current software. Running the provided code in ArcGIS Pro 3.5 returns "qwer_ty", which is as designed.
Note: ValidateTableName has two arguments, the table name and the workspace to validate the name against. Best practice is to include the workspace argument. If the workspace is not specified, the name validation runs using the current workspace, if the workspace is not set, it runs using the folder workspace, which has very few character constraints.