Hi Lurtz - good question! There are different approaches to AI difficulty. None of which are perfect imo. Two that I've considered:
Baseline difficulty + adjustments per track: once you have a sense for your average ("baseline") difficulty, you can then adjust it for each track based on how well you know/think you'll do. As an example, my own difficulty baseline is around 90 (meaning over the course of a season my average is about 90). For tracks I do well, such as Austria, I increase my difficulty by 5. For tracks I suck at, such as Vietnam, I decrease by 7. The page I've linked to is helpful with this approach, as it shows the average difficulty adjustment for each track.
Laptime comparison: this approach is similar to what you've asked about. You first set your own laptime on a track, then compare it with some online benchmark which spits out the recommended difficulty. This works well if you're willing to always hop into Time Trial mode to set a few laptimes. It's important that you use Time Trial (and always the Mercedes), because laptimes depend on factors such as car performance, tire wear, engine mode, etc. Time Trial is the only mode that keeps those constant. If you'd set a lap in My Team Practice, for instance, you'd get a much slower laptime (e.g. because engine mode is lower, or because your car is weaker); and the slower laptime would then result in a lower suggested difficulty by any "difficulty calculator". Personally, I don't want to go to Time Trial each time I'm about to race a Grand Prix... hence I stick with approach #1.
I'd love to hear if anyone has different approaches to this! With regards to the second approach, my friends and I are working on publishing our average laptime by difficulty data as well -- I'll post it here shortly, stay tuned. Please let me know if there's anything else I can help with - would love to hear more opinions on how to improve our data and make everyone's F1 experience better 🙂