By looking at the code it seems that TCU_SIZE_DEVICE_NAME is an arbitrarily chosen limit for a device name, that should be big enough for most use cases.
If not, you can increase it - but there may be negative side effects.
As you probably know, the advertising data and the scan response can include max. 31 bytes.
If you use the automatic Bluetooth SDK advertising functions then these might not work as expected any more. If a very long device name is included in the advertising data it might not be possible that other information is included in the advertising data or scan response.
In that case it might be necessary that you hand-craft your own advertising and scan response data so that it includes the information that you want.
Another problem could be the MTU size. TCU_SIZE_DEVICE_NAME is used as a size for the device name of the device information service.
If your devices do not do a MTU size negotiation and the MTU size is always the default of 23 bytes, then remote devices cannot uses a simple GATT read to read the whole device name in one go.
Properly written applications should be able to handle that, but there may be applications out there that will truncate the device name from the device information service.