Software problem was excluded, also problem with GPU (external monitor doesn't flickering)
Excellent troubleshooting clue. Good job. That fact that an external monitor is not affected obviously points to something in the display itself of its cabling. The display and its cable are one sealed assembly and components thereof cannot be separately replaced.
The best-case scenario is the the connection between between the display cable and the logic board is simply loose. However, if the cable's attachment point on the board is physically damaged, that means a new logic board.
As this seems at least somewhat temperature related, it behooves you to make every effort to keep temps down. 13-inch models get some cooling air through the keyboard. Using a keyboard protector or running in "clamshell" mode will affect temps in the 13-inch models.
The 15-inchers have air intakes (denoted in blue in the photo) on the sides where the bottom cover meets the chassis:
These must not be obstructed by a table cover or stuff on your workstation. Both models exhaust hot air from the hinge area (red outline). I try to keep that area 4-6 inches from anything on the desk.
Software: Unneeded anti-virus software and so-called "cleaning" apps can increase heat. So can client-side VPNs. Google Chrome is a known resource hog and may cause the hardware to produce more heat.
Unless those suggestions help, this type of video issue is almost always beyond a home fix, even by an experienced user. You can run Apple Diagnostics to get further clues but, ultimately, you will need Apple to evaluate.