Can't speak to firmware code or complex cryptography but my hunch is if it's in it's training dataset and you know enough to guide it, it's generally pretty useful.
Presumably humanity still has room to grow and not everything is already in the training set.
The problem is rather that programmers who work on business logic often hate programmers who are actually capable of seeing (often mathematical) patterns in the business logic that could be abstracted away; in other words: many business logic programmers hate abstract mathematical stuff.
So, in my opinion/experience this is a very self-inflected problem that arises from the whole culture around business logic and business logic programming.
This rather tells that the kind of performance optimizations that you ask for are very "standard".
If you really care about using the hardware effectively, optimizing the code is so much more than what you describe.