How to set the currently active page in the menu including parents

It sounds like you may be over-complicating this. If your goal is to highlight a post’s top parent while the post is listed in a sub-menu of said parent, then this is a CSS problem, not a wordpress one. The following should work:

.current-menu-parent a, .current-menu-ancestor a {
 color: #7dca8d;
}

tech