[runtime] Move thread attaching to mono-threads from the io-layer.