clang-tidy: Enable bugprone-unchecked-optional-access

Enable bugprone-unchecked-optional-access to detect the case that it
accesses std::optional without checking empty.

See https://gerrit.openbmc.org/c/openbmc/docs/+/78034 for details.

This commit also fixes quite a few issues reported by clang-tidy:

* Add necessary includes in the hpp files;
* Move the template function `selAddSystemRecord()` into hpp;
* Fix the uncheck access of `expireAction`.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I4ad3cc07510a03965a2b4ae9c08fe452433ccdab
diff --git a/include/threshold_alarm_event_monitor.hpp b/include/threshold_alarm_event_monitor.hpp
index 6b0544a..9fe7e0a 100644
--- a/include/threshold_alarm_event_monitor.hpp
+++ b/include/threshold_alarm_event_monitor.hpp
@@ -15,7 +15,10 @@
 */
 
 #pragma once
+#include "threshold_event_monitor.hpp"
+
 #include <boost/container/flat_map.hpp>
+#include <sdbusplus/bus/match.hpp>
 #include <sel_logger.hpp>
 #include <sensorutils.hpp>