Was this denial of entry legal?
Probably not. Type D visas are automatically valid for short visits (subject to the 90/180 rule) to other Schengen countries, regardless of the "valid for" entry, perhaps unless there is an explicit annotation restricting short visits. I'm (I'm not sure about the last part thereexplicit annotations, more specifically how it works when one Schengen country wants to issue a D visa despite another Schengen country's having banned the same individual, but it doesn't seem to be relevant to your visa onor to you in any event.)
This has been the case since 2010, thanks to Regulation (EU) No 265/2010.
would the Hungarian authorities have entered this incident in SIS?
I doubt it. If they had, they should have informed you in writing. Regulation (EU) 2018/1861, article 52:
Right of information
1.
Third-country nationals who are the subject of an alert in SIS shall be informed of this in accordance with Articles 13 and 14 of Regulation (EU) 2016/679 or Articles 12 and 13 of Directive (EU) 2016/680. This information shall be provided in writing, together with a copy of or a reference to the national decision giving rise to the alert, as referred to in Article 24(1) of this Regulation.2.
This information shall not be provided where national law allows for the right of information to be restricted, in particular in order to safeguard national security, defence, public security, and the prevention, detection, investigation and prosecution of criminal offences.
Could it result in problems now that I am in the process of applying for blue card in Germany?
I suppose that it's possible, in theory. But since the whole affair seems to have been illegal, it's unlikely that they entered an SIS alert. You do have some limited rights to inquire about your data in SIS and to ask to have it corrected, if it is incorrect. You can find more information about that in the answer to What is the equivalent of a subject access request for the Schengen Information System (ie, SIS)? over at Travel.