Is there a way to insert driver into modifier value?

Or any other way to make modifier influence conditional?

For what you’re showing, put the f-curve modifier on an empty or something instead-- same parenting, same location as the cube. Give the cube a copy location constraint targeting it. Use a driver for the influence of the constraint.

Other modifier setups might deviate a bit. Obviously, copy location won’t get you rotation. Additive fcurve modifiers should be handled with “offset” constraints.