kernel: thread: Simplify k_thread_foreach conditional inclusion
kernel: thread: Simplify k_thread_foreach conditional inclusion

Simplify k_thread_foreach API conditional inclusion by putting
the whole logic under CONFIG_THREAD_MONITOR config option.

Signed-off-by: Ramakrishna Pallala <8cb5df094165bcc31e7d772ccd8d87d8c4d8f761@intel.com>

galak/zephyr,nashif/zephyr,GiulianoFranchetto/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,punitvara/zephyr,finikorg/zephyr,Vudentz/zephyr,punitvara/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,zephyrproject-rtos/zephyr,kraj/zephyr,explora26/zephyr,explora26/zephyr,zephyrproject-rtos/zephyr,ldts/zephyr,explora26/zephyr,finikorg/zephyr,punitvara/zephyr,nashif/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,ldts/zephyr,zephyrproject-rtos/zephyr,kraj/zephyr,galak/zephyr,nashif/zephyr,punitvara/zephyr,finikorg/zephyr,GiulianoFranchetto/zephyr,kraj/zephyr,nashif/zephyr,Vudentz/zephyr,Vudentz/zephyr,ldts/zephyr,nashif/zephyr,kraj/zephyr,explora26/zephyr,galak/zephyr,galak/zephyr,ldts/zephyr,kraj/zephyr,galak/zephyr,explora26/zephyr,Vudentz/zephyr,Vudentz/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,Vudentz/zephyr