There are some basic troubleshooting steps you could start with to help diagnose and/or fix this.
The first things I'd try are to reset both the NVRAM and SMC in that order. Before following the steps below, ensure you have no external hardware connected (so, unplug your external display) and make sure you use the built-in keyboard.
Reset the NVRAM
Here’s how to reset the NVRAM on your particular MBP:
- Shut down your machine. Yes, a full shut down, not just logging out.
- Press the power button and then press the commandoptionpr keys. You have to make sure you press these keys before the gray screen appears or it won’t work.
- Hold those keys down until your Mac reboots again and you here the startup chime.
- Let go of the keys and let your Mac reboot normally.
Note: When you log back in you may need to readjust some of your system preferences (e.g. speaker volume, screen resolution, startup disk selection, time zone information, etc).
Reset the SMC
To reset the SMC on your particular MBP, follow these steps:
- Shut down your computer
- Keep the power cable plugged in.
- Press at the same time shiftoptioncontrol (on the left side of the keyboard) and the power button
- Let go
- Turn your computer back on with the power button.
After resetting both the NVRAM and SMC, use your computer to determine if the issue still persists. If it does, try booting into Safe Mode as described below.
Boot into Safe Mode
Follow these steps to boot your Mac into Safe Mode:
- Fully shut down your Mac
- Restart your Mac
- Immediately press the Shift key and keep it down
- Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
- Take a note of what happens (i.e. with your external display attached, do you still notice issues with your built-in screen?)
- When ready, exit Safe Mode just restart your Mac as normal
- Now test your Mac again to determine the current status of your problem
If your Mac is still having this problem after trying all of the above, I'd test your hardware by running Apple Diagnostics.
Run Apple Diagnostics
Follow the steps below to run Apple Diagnostics:
- Fully shut down your Mac
- Restart your Mac
- Immediately press the D key and keep it down until you see the Diagnostics screen appear
- Wait for Diagnostics to finish (this typically only takes a few minutes)
- Once complete, one of two things will appear on the screen:
- a No issues found message
- a brief description of any errors found plus further instructions
- If the diagnostics test does find errors, take a note of what they are
Note: If pressing and holding the D key at Step 3 doesn't work, start again at Step 1 and, at Step 3 press and hold both the OptionD keys instead. This will try and run diagnostics from the internet instead, so you will need to allow more time for it to complete.
Regardless, take a note of what happens and let me know how you went.