For most proposals like this, new years day and leap day wouldn't have a day of the week. And therefore the calendar wouldn't change from year to year.
I think your code is fine. The Gregorian Calendar actually runs on a 400-year cycle (i.e. the pattern caused by 7-day weeks, variable-length months and leap years repeats every 400 years) so if you re-ran the code against a 400-year period you'd get the correct ratios.