Yes, you can pay Madness costs with Dark Ritual even on the cleanup step discard.
In order to pay a mana cost, you either need to already have the required mana floating, or you need to activate a mana source when it comes to paying that cost. You are correct in that spells, like Dark Ritual, are not mana sources:
605.5b A spell can never be a mana ability, even if it could put mana into a player’s mana pool when it resolves. It’s cast and resolves just like any other spell. Some older cards were printed with the card type “mana source”; these cards have received errata in the Oracle card reference and are now instants.
You are also correct in that players don't get priority during the cleanup step, so you could neither have mana floating (since the mana pool emptied at the end of the previous step), nor could you cast Dark Ritual before or during the resolution of Madness.
However, since Madness results in a triggered ability going on the stack during the cleanup step, an exception applies:
702.34a Madness is a keyword that represents two abilities. The first is a static ability that functions while the card with madness is in a player’s hand. The second is a triggered ability that functions when the first ability is applied. “Madness [cost]” means “If a player would discard this card, that player discards it, but exiles it instead of putting it into their graveyard” and “When this card is exiled this way, its owner may cast it by paying [cost] rather than paying its mana cost. If that player doesn’t, they put this card into their graveyard.”
514.3. Normally, no player receives priority during the cleanup step, so no spells can be cast and no abilities can be activated. However, this rule is subject to the following exception:
4.3a At this point, the game checks to see if any state-based actions would be performed and/or any triggered abilities are waiting to be put onto the stack (including those that trigger “at the beginning of the next cleanup step”). If so, those state-based actions are performed, then those triggered abilities are put on the stack, then the active player gets priority. Players may cast spells and activate abilities. Once the stack is empty and all players pass in succession, another cleanup step begins.
The Madness trigger goes on the stack after you discard in the cleanup step, causing players to get rounds of priority until the stack is empty and everyone has passed in succession. Because of that, you may cast Dark Ritual and put it on the stack above Madness. It resolves before the Madness trigger does, and you can pay the Madness cost with that mana.