Don't worry about Text to Code ratio because text to code ratio does not matter.
It hasn't in years. I remember someone from G discussing this 6 or 7 years ago(Matt Cutts?) and saying that some content management systems and apps created all kinds of extra code and so it wasn't a good signal for ranking purposes. "Worry about what users can see" was the conclusion.
It may be possible to use a JavaScript listener to detect when a div is in the viewport and load it at that point. [javascripttutorial.net]
If you use listeners, services like lighthouse recommend.using passive listeners where possible for performance reasons, not active ones. - [
web.dev...]
If you're going to lazy load 3rd party content it's recommended you also use facades - [
web.dev...]
A facade is a static element which looks similar to the actual embedded third-party, but is not functional and therefore much less taxing on the page load.
The facade image will trigger image optimization checks and using the latest image type recommendations. Round and round we go.
If your site relies on user generated content for rankings it becomes fodder for savy SEOs who know they can outrank virtually any forum page. This is true for all websites but spotting a top ranking forum makes some SEOs especially interested. It's easy to do with all the ranking metrics reporting services available today.
Some 3rd party comment systems give you the option of letting Google index the UGC or not. Remember, the comments aren't on your domain with 3rd party services so how the 3rd party service includes the comments on your page matters. This is perhaps easier than using event listeners, lazy load etc.
I'm not saying don't do what you mentioned doing, but do look at other successful sites that have done what you're planning before you jump in. It's not trivial, success is very dependent on implementation(incl code AND moderation) when it comes to UGC.
Good luck!
edit: I felt OLD writing this, I remember a time when every product had a fan forum. There's a reason that's not the case anymore. UGC is HARD to rely on for good rankinigs, it used to be easy(ish)