The obvious answer you mentioned should be reiterated: Avoid thunderstorms whenever possible! Just because there are "best penetrating altitudes" doesn't change the fact that thunderstorms are extremely hazardous to aircraft and should be avoided in the first place.
With that said, the FAA's Advisory Circular 00-24C mentions that, if unable to avoid penetrating a thunderstorm:
To avoid the most critical icing, establish a penetration altitude below the freezing level or above the level of -15ºC.
This is to help minimize rapid accumulation of clear ice:
Supercooled water freezes on impact with an aircraft. Clear icing can occur at any
altitude above the freezing level but at high levels, icing from smaller droplets may be rime or
mixed rime and clear. The abundance of large, supercooled water droplets makes clear icing very
rapid between 0ºC and -15ºC, and encounters can be frequent in a cluster of cells. Thunderstorm
icing can be extremely hazardous.
Another point to mention is that, regardless of there being a recommended "penetration altitude," it is important to maintain a constant attitude, not altitude:
It is almost impossible to hold a constant altitude in a thunderstorm, and maneuvering
in an attempt to do so greatly increases stress on the aircraft. Stresses are least if the aircraft is
held in a constant attitude.
But again, emphasizing the dangers of thunderstorms, the circular states:
Never regard any thunderstorm lightly, even when radar
observers report the echoes are of light intensity. Avoiding thunderstorms is the best policy.
and
Weather recognizable as a thunderstorm should be considered hazardous,
as penetration of any thunderstorm can lead to an aircraft accident and fatalities to those on
board.