wallet: move Assert() check into constructor
This puts it in a function body, so that func is available
for reporting any assertion failure.
util/check: stop using lambda for Assert/Assume
util/check: avoid unused parameter warnings
refactor: Add LIFETIMEBOUND / -Wdangling-gsl to Assert()
Rationale from PR description:
Using a lambda creates a couple of odd namespacing issues, in particular making clang's thread safety analysis less helpful, and confusing gcc when calling member functions. Fix this by not using a lambda.
This is a backport of core#24714, core#24729 and core#25248.
This is a requirement for core#25077 because a lambda cannot be used with LOCK.
Depends on D14620