RAW: A self-attack requires the Attack action
Starting with the Other Activity on Your Turn section, we are told what sorts of activities we can take for free. I've excluded the irrelevant parts:
Other Activity on Your Turn
Your turn can include a variety of flourishes that require neither your action nor your move.
...
You can also interact with one object or feature of the environment for free, during either your move or your action. For example, you could open a door during your move as you stride toward a foe, or you could draw your weapon as part of the same action you use to attack.
...
The DM might require you to use an action for any of these activities when it needs special care or when it presents an unusual obstacle. For instance, the DM could reasonably expect you to use an action to open a stuck door or turn a crank to lower a drawbridge.
None of the descriptions offered here provide anything about doing damage to an object or creature, so at best it's something the DM would require an action for. So lets jump to the Use an Object section of actions to see if there's any type of interaction with an object that can do damage:
Use an Object
You normally interact with an object while doing something else, such as when you draw a sword as part of an attack. When an object requires your action for its use, you take the Use an Object action. This action is also useful when you want to interact with more than one object on your turn.
IMPROVISING AN ACTION
Your character can do things not covered by the actions in this section, such as breaking down doors, intimidating enemies, sensing weaknesses in magical defenses, or calling for a parley with a foe. The only limits to the actions you can attempt are your imagination and your character’s ability scores. See the descriptions of the ability scores in the Using Ability Scores section for inspiration as you improvise.
When you describe an action not detailed elsewhere in the rules, the DM tells you whether that action is possible and what kind of roll you need to make, if any, to determine success or failure.
Again, nothing here that immediately stands out except for breaking down a door, but typically that runs as a skill check, and not something that targets hp. The only other part that seems relevant is "When you describe an action not detailed elsewhere in the rules...". So since there are rules for doing damage under attacks, lets see if this type of activity is covered under the Attack action:
Attack
The most common action to take in combat is the Attack action, whether you are swinging a sword, firing an arrow from a bow, or brawling with your fists.
With this action, you make one melee or ranged attack. See the "Making an Attack" section for the rules that govern attacks.
So this sends us down to the Making an Attack rules:
Making an Attack
Whether you're striking with a melee weapon, firing a weapon at range, or making an attack roll as part of a spell, an attack has a simple structure.
Choose a target. Pick a target within your attack's range: a creature, an object, or a location.
Determine modifiers. The DM determines whether the target has cover and whether you have advantage or disadvantage against the target. In addition, spells, special abilities, and other effects can apply penalties or bonuses to your attack roll.
Resolve the attack. You make the attack roll. On a hit, you roll damage, unless the particular attack has rules that specify otherwise. Some attacks cause special effects in addition to or instead of damage.
If there's ever any question whether something you're doing counts as an attack, the rule is simple: if you're making an attack roll, you're making an attack.
Based on the rules laid out here, it seems that this best qualifies as an Attack action, since you are making a damaging attack against a creature in range (yourself). The other interactions don't cover this kind of activity, but this specifically does.
As to whether or not this would/should require an attack, there are other questions that discuss that.
Could it even sustain a barbarian's Rage anyways?
As NautArch pointed out in the related question he linked, a barbarian's Rage feature says:
It ends early if you are knocked unconscious or if your turn ends and you haven't attacked a hostile creature since your last turn or taken damage since then.
Hostile is the key word here. To be hostile the creature must be opposed or antagonistic to your goals (English definition). Because you are inherently aligned to your own goals and objectives, by definition you cannot be hostile to yourself. Thus, the action of self attacking would not qualify for fueling rage, though any damage done would.