Is there a programmable thermostat that allows a totally custom program?

Some thermostats have a “vacation mode” that runs for a preset length of time or until you manually turn it off (e.g., Honeywell Prestige HD).

At some point any pre-programmed thermostat has its limits- e.g., if you are on a 9-day week maybe the manufacturer did not anticipate that. Maybe it’s a job for the Arduino/Raspberry Pi project thread (program it yourself), certainly cheaper than paying $200 and discovering it does not quite do what you want.