Can you clarify what you mean by "coding the driver instead"?
AI is just a form of algorithms and math, like any other program code.
I have not seen LFS's code but generally AI in video games works like this:
The AI-code takes some data as input and outputs data as control.
In a racing game the input might be:
-car speed
-engine rpm
-car position
-track layout
-car properties (weight, condition of tires, center of gravity,...)
The more input data is taken into account, the more detailed the calculations can be.
and the output would be:
-steering wheel angle
-throttle position
-brake position
-all the other driving controls, like clutch, gearbox etc
Notice that for a non-cheating AI, this would be the same as for humans.
To get from use "data input" to "controls output", there needs to be some AI program code. The more detailed this code is, the better/faster/life-like the AI driver will be.
There is an old 2D racing game called "RARS" that was not about driving but about programming AI that would drive the cars.

In this link someone briefly explains how his AI-driver worked:
https://rars.sourceforge.net/selection/felix.html
Also interesting, but more technical:
https://rars.sourceforge.net/help.html
click "Tutorial Part 1,2,3,etc"
It explains in more detail how to code an AI for that racing game. The basic principle should apply for LFS too, just that LFS physics are more complex.