likely original purpose of this type of rod is to hang kitchen towels, dish towels, or other lightweight items.
The decorative finials on both ends make it look more like a traditional towel bar or utility hanger than a purpose-built trash-bag dispenser.
Fixtures like this were commonly installed in kitchens because they provide a convenient place to hang something within easy reach.
And the location makes sense.
It’s positioned right beside the countertop and sink area, where a kitchen towel would naturally be needed.