> why can’t nested functions just be normal functions inside a namespace
Because GCC's nested functions are closures - they can access local variables within the function.