[System/Security] Memprot after-merge improvements (v5.0) Closes IDF-5263 and IDF-5208 See merge request espressif/esp-idf!18893