BUG : Terrain Following with Obstacle Avoidance(Bendy Ruler)

Frame: HexaCopter
Firmware Version : Arducopter 4.0.4
Hi,
I want to report a problem when using Terrain Following in Auto Mode, when Obstacle Avoidance is active.
The Copter does not seem to follow terrain when the front facing lidar is enabled. I haven’t tested it at high altitude but when the copter is at ~5m of altitude the vehicle follows the barometer, instead of Rangefinder. and it seems like the bendy ruler is active for some reason as the vehicle deviates from it’s path.
I want to know whether if it’s a bug or a missing feature, and in any case if this issue can be fixed or worked around.

Thanks !

Logs - https://drive.google.com/file/d/1K9EDu0XW4Q8KL5uSnjJjBlntYfpREzo2/view?usp=sharing