Trajectory was there. BG3 is an iteration of those two games and earlier ones.
D:OS sold 500,000 copies in 3 months, making over $10,000,000 on a development budget of $4 million. Not AAA numbers, but Larian more than doubled their investment.
BG3 whilst undeniably a massive success was likely always going to perform very well for Larian. The suprise was mostly that it ended up being a GOTY title I think.
They've always been good. very good. And you know they're committed for the right reasons because they re-did large parts of DOS2 for free based upon community response.
I can't think of another studio who has willingly done that for people who have already paid.
Go back and play the original divine divinity. It's very good.
BG3 being a masterclass in game development shocked no one who has followed Larian over the years.