Continuum robots, with their slender, flexible structures, are increasingly utilized in delicate tasks. These robots must navigate confined spaces with high precision, often employing follow-the-leader (FTL) motion to ensure minimal trauma. The baseline FTL motion planning algorithm can not adjust the continuum robot's configuration using all the segments, especially the tail of the robot. Furthermore, it has limitations in dynamic, obstacle-rich environments, where real-time re-planning and obstacle avoidance are essential but often not sufficiently addressed. To address the above gaps, we propose a novel FTL motion planning framework inspired by snake hole-digging motions that can configure its optimal shape during the insertion task. Our approach outperforms the baseline FTL by 75.36%. The framework incorporates real-time obstacle avoidance by integrating Control Barrier Functions (CBF) and Quadratic Programming (QP) into the motion re-planning process. To avoid deviations caused by obstacle avoidance, the Control Lyapunov Function (CLF) is also integrated, forming a CLF-CBF-QP framework for online motion re-planning. The target reaching error of using CLF-CBF-QP decreases by 69.15% compared to using only CBF-QP. We also provide the open-source code of this work online.