Except when you customize a variable and click save for future sessions or apply and save, all the customized variables including the hacked connection local alist variables will be dumped to the customs file.
On 4 Jun 2023 at 12:42 PM +0100, Michael Albinus <michael.albinus@gmx.de>, wrote:
Jimmy Wong <wyuenho@gmail.com> writes:

Hi,

I have since found out that simply M-x load-library tramp will have
these connection-local-*-alist variables set without haven’t done
anything.

Yes, that's intended. But nothing should have been written to your init
file with this scenario.

Best regards, Michael.