They are stripped in a release build, but profiling is usually done on dev builds or in editor so we have more insight and get builds faster than an IL2CPP release compile. Nobody wants to wait 30 mins for a compile every time they change one or two lines to optimize the core loop and start looking for the next worst offender.
I think that the garbage is created by this part of your assertion:
“RecordedChainCount (” + m_Data->m_RecordedChainCount + “) != initialChainCount (” + initialChainCount + “)”
Strings are the absolute champions in the contest of the garbage generation. And here your every assertion causes the creation of a new string (4 strings to be exact), which goes as an argument to Assert.IsTrue.
So the partial solution is to put an immutable string here (“m_RecordedChainCount is not equal to initialChainCount”).
If it signals you an error, you can put a break point and find the source of the problem.