I've had a lot of good experiences with Jekyll, and I'm fairly sure that the problem you've described would have worked nicely with it. Extending it is also really straightforward, you just put a few lines of Ruby in a file in the right place.
I've moved my site from Jekyll to Gatsby, and while there are some nice things, it's not been a clear win. My site is very significantly slower for first load, but slightly faster for all subsequent loads. The build is far less stable with Gatsby, there are ~5 dependency updates per day, things like Sass don't "just work" anymore, but on the other hand, there are a few more packages that do useful things that I didn't get in the Jekyll community.
I've moved my site from Jekyll to Gatsby, and while there are some nice things, it's not been a clear win. My site is very significantly slower for first load, but slightly faster for all subsequent loads. The build is far less stable with Gatsby, there are ~5 dependency updates per day, things like Sass don't "just work" anymore, but on the other hand, there are a few more packages that do useful things that I didn't get in the Jekyll community.