refactor: Make TraceThread a non-template free function
Also it is moved into its own module.
refactor: Use appropriate thread constructor
refactor: Replace std::bind with lambdas
Lambdas are shorter and more readable.
Changes are limited to std::thread ctor calls only.
This is a backport of core#19064
Notes:
- The mapport source file does not exist because we are missing core#18077
- D11828 added an argument for CConnman::ThreadOpenConnections