Is there any constraint on how many waypoints may be in a flight plan (any regulation), including pilot defined waypoints?
The only info about this I have been able to find is this quote from the ICAO:
ATS data systems may impose communications or processing constraints on information in filed flight plans. Possible constraints may, for example, be limits regarding item length, number of elements in the route item, or total flight plan length. Significant constraints are documented in the relevant Aeronautical Information Publication.
Which essentially just says that individual countries could impose (due to technical reasons) restrictions, but there are no general rules.
I have no doubt that many ATS systems would probably break if you asked them to process an unreasonably long flightplan. Hopefully the flightplan processing system is set up to reject such flightplans before they make it into the live system.
After playing around a bit with the EUROCONTROL flightplan validator tool (IFPUV), I have noticed that it starts throwing a syntax error when the FPL message is above approximately 985 characters in total. It's hard to say if this is just a limitation of the validator or if it's actually a limitation of the flightplan processing system. The actual error message is "SYN73: SUSPECT INVALID FIELD (F15 GENERATES TOO MANY RENAMED POINTS)", which I haven't been able to find an explination for in any of the usual EUROCONTROL manuals.
So, for practical purposes, you should probably keep your entire flightplan below ~985 characters, at least if you want it accepted in European airspace. But refer to the local AIP (probably ENR 1.10) of whichever country you are flying in to check if any local restrictions are mentioned.