Not really an answer, and I am afraid it might not help you, but too long for a comment, and it might help someone else.
I wonder if there is a simple and clean way to do this in pdftex or luatex. In luametatex, a more flexible hyphenation setup is implemented. One can use \hyphenationmode (see the luametatex manual) to set it up (or use the defaults that seem to work well). In lang-ini.mkxl, in a ConTeXt distribution, one can find something like
\permanent \integerdef \completehyphenationcode \numexpr
\normalhyphenationcode % \discretionary
+ \automatichyphenationcode % -
+ \explicithyphenationcode % \-
+ \syllablehyphenationcode % pattern driven
+ \uppercasehyphenationcode % replaces \uchyph
+ \compoundhyphenationcode % replaces \compoundhyphenmode
% \strictstarthyphenationcode % replaces \hyphenationbounds (strict = original tex)
% \strictendhyphenationcode % replaces \hyphenationbounds (strict = original tex)
+ \automaticpenaltyhyphenationcode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
+ \explicitpenaltyhyphenationcode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty)
+ \permitgluehyphenationcode % turn glue into kern in \discretionary
+ \permitallhyphenationcode % okay, let's be even more tolerant
+ \permitmathreplacehyphenationcode % and again we're more permissive
+ \forcehandlerhyphenationcode % kick in the handler (could be an option)
+ \feedbackcompoundhyphenationcode % feedback compound snippets
+ \ignoreboundshyphenationcode % just in case we have hyphens at the edges
+ \collapsehyphenationcode % collapse -- and ---
\relax
\permanent \integerdef \partialhyphenationcode \numexpr
\ignoreboundshyphenationcode % just in case we have hyphens at the edges
% + \explicithyphenationcode % -
- \collapsehyphenationcode % collapse -- and ---
\relax
\permanent\protected\def\dohyphens {\hyphenationmode\completehyphenationcode}
\permanent\protected\def\nohyphens {\hyphenationmode\partialhyphenationcode}
Hyphenations are on by default, but following the code above, we can switch them off by \nohyphens. Of course, one can have a more granular setup as well by setting the different bits (one can switch one with \bitwiseflip).
Here is a small example where we change the hyphenation setting locally (to prohibit the wanted hyphenation, therefore in red):
\starttext
% \showhyphens{category}
\typ{\showhyphens{category}}
\typ{languages > hyphenation > show: cat[-||]e[-||]gory}
\blank
\hsize 1.4cm
\blackrule[width=\hsize]\par
$\infty$-category
\blank
\hsize 7cm
\blackrule[width=\hsize]\par
Oh, it's like that, it's like that {\red\nohyphens$\infty$-category.}
Yeah, it's like that, it's like that $\infty$-category. Woah-oh-oh, oh-oh-oh.
\stoptext

$\infty$-cate\-gorywhere\-is a “soft hyphen”. For longer words where you don't want to specify each single possible break point with\-thebabelpackage can provide a shorthand for the actual hyphen that still would allow other break points. In some language, this is"=, i.e.$\infty$"=category(with the right settings). – Qrrbrbirlbel Jun 09 '23 at 01:07\hyph. (I'm looking for a better example.) The usage would then be$\infty$\hyph category. – barbara beeton Jun 09 '23 at 01:12