Puzzles are more puzzling when the pieces almost fit together, but for some unexplained reason, just don't fit. In other words, a comparison should be made between two almost (but not quite) similar things.
In this case, stearic and benzoic acids are quite different. They have some carbons (quite different, and not even the same number!), and one similar group of four atoms ($-COOH$) - not very much similarity.
How about we compare the melting points of octadecane and stearic acid - and their structures? There's a lot of similarity there, and a little dissimilarity. Octadecane melts at 28-30 C (Ref. 1) vs. stearic acid at 69.3 C (Ref. 2). Obviously the difference is caused by the added stickiness of the carboxyl groups for one another, because they form dimers in the crystal, a structural feature (Ref. 3) lacking in the paraffin.
That establishes that a carboxyl group raises the melting point of a paraffin chain. An x-ray structure for $C_{24}H_{50}$ (octadecane not available) looks just like the one for stearic acid, but without the carboxyls (Ref. 4).
Now let's compare benzoic acid with toluene. The numbers of carbons are the same, and we just convert one $CH_3$ group to a $COOH$, as in the previous comparison. Toluene stacks in the solid (Ref. 5) with energies about 3-4 kcal/mol, which isn't much, considering that toluene melts at -95 C. But benzoic acid stacks nicely (Ref. 6) and melts at 122 C.
Now there's a puzzle: why does a carboxyl group raise the mp of a paraffin by 40 degrees, but raises the mp of an aromatic ring by 217 degrees? Looking at the formulas, looking at the drawings of a molecule (or two) doesn't help. Looking at actual data (because those little molecules have a mind of their own, and we have a hard time thinking like they do) like x-ray crystal data, suggests that putting a little planar group ($COOH)$ onto a long chain might strengthen intermolecular bonding a little, but extending a ring's planarity and adding in some hydrogen bonding, which amplifies the extent of planarity could do some powerful intermolecular stickiness.
I guess the wiggly straight chains don't have such good contact with their neighbors as the benzoic acid dimers do. Who would have guessed, without the crystal structure data?
Will puzzles never cease? If octadecane melts at 28-30 C, and its mp is raised by turning a methyl into a carboxyl, you might wonder what a phenyl group would do. Apparently, not much. The mp of 1-phenyloctadecane is 29 C (Ref. 7).
Ref.1 https://en.wikipedia.org/wiki/Octadecane
Ref.2 https://en.wikipedia.org/wiki/Stearic_acid
Ref. 3 https://www.researchgate.net/figure/Crystal-packing-of-left-the-A-super-14-and-right-the-A-1-13-two_fig1_233992144
Ref. 4 https://www.researchgate.net/figure/Crystal-structure-of-C-24-H-50_fig1_270344720
Ref. 5 https://www.x-mol.com/paper/6024417
Ref. 6 https://www.researchgate.net/figure/Selected-intermolecular-contacts-in-the-benzoic-acid-crystal-viewing-the-dimers-from-the_fig2_51049984
Ref. 7 https://pubchem.ncbi.nlm.nih.gov/compound/1-Phenyloctadecane#section=Experimental-Properties