session: improve bootstrap code (#34755)
session: improve bootstrap code (#34755)

close pingcap/tidb#34754
kyle-wang/tidb,kyle-wang/tidb,pingcap/tidb,pingcap/tidb,pingcap/tidb,pingcap/tidb,ngaut/tidb,ngaut/tidb,kyle-wang/tidb,kyle-wang/tidb,ngaut/tidb,kyle-wang/tidb,pingcap/tidb,ngaut/tidb,kyle-wang/tidb,ngaut/tidb,ngaut/tidb,pingcap/tidb