My approach is to understand the topic one level deeper than is needed to satisfy my immediate needs. It’s not always enough but it usually exposes any obvious traps you’d run into with only a surface level understanding, or at least lets you know if the thing really is too complex to not understand deeply and still succeed.
"one level deeper" is a great way to look at it!
You aren't really a generalist if all you do is solve the problem without understanding anything, and this approach will usually bite you or your replacement down the line. Just consider solving "I need a message queue", "I need to add Elasticsearch", or gods forbid, "We need a frontend JS framework". I've been at companies where this has happened, and it's a dumpster fire weeks afterward.